<p><div><div><div><div data-width="100" data-show-faces="false" data-send="true" data-layout="button_count" data-height="21" data-href="https://www.r-bloggers.com/creating-figures-like-the-paper-completeness-of-digital-accessible-knowledge-of-plants-of-ghana-part-1/"></div></div><div><a data-url="https://www.r-bloggers.com/creating-figures-like-the-paper-completeness-of-digital-accessible-knowledge-of-plants-of-ghana-part-1/" data-counturl="https://www.r-bloggers.com/creating-figures-like-the-paper-completeness-of-digital-accessible-knowledge-of-plants-of-ghana-part-1/" data-count="horizontal" data-text="Creating figures like the paper ‘Completeness of Digital Accessible Knowledge of Plants of Ghana’ Part 1" class="twitter-share-button" data-via="rbloggers" href="https://twitter.com/share"></a></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="https://vijaybarve.wordpress.com/2016/10/27/creating-figures-like-the-paper-completeness-of-digital-accessible-knowledge-of-plants-of-ghana-part-1/"> Vijay Barve</a></strong>, and kindly contributed to <a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers)</a> </div>
<p>Recently I got to read the paper about Completeness of Digital Accessible Knowledge DAK by Alex Asase and A. Townsend Peterson. I really enjoyed reading the paper and liked the way the figures are presented. There is a lot of overlap of this with my work on <a target="_blank" rel="nofollow" href="https://cran.r-project.org/web/packages/bdvis/index.html">package bdvis</a> (of course under guidance of Town Peterson). So I thought I will share some code snippets to recreate figures similar to the ones in the paper using package bdvis.</p>
<p>Since I do not have the copy of the data in the paper, I am using data downloaded from <a target="_blank" rel="nofollow" href="http://www.gbif.org/occurrence/download/0008383-160526112335914">GBIF website</a>. I decided to use Birds data for India.</p>
<p>To create Figure 1a. Graph showing accumulation of records through time (years) we need to set the data in bdvis format and then use function distrigraph.</p>
<pre>
library(bdvis)

# Download GBIF data from data.gbif,org portal and
# extract occurrence.txt file in Data folder
occ &lt;- read.delim( 'verbatim.txt',
                          quote='', stringsAsFactors=FALSE)
# Construct Date field form day, month, year
occ$Date_collected &lt;- as.Date( paste( occ$year,
                                      occ$month ,
                                      occ$day , sep = &quot;.&quot; ),
                               format = &quot;%Y.%m.%d&quot; )
# Set configuration variables to format data
conf &lt;- list(Latitude='decimalLatitude',
             Longitude='decimalLongitude',
             Date_collected='Date_collected',
             Scientific_name='specificEpithet')
occ &lt;- format_bdvis(occ, config=conf) occ_date=occ[occ$Date_collected > as.Date(&quot;1500-01-01&quot;) &amp;
           occ$Date_collected &lt; as.Date(&quot;2017-01-01&quot;) &amp;
           !is.na(occ$Date_collected) ,]
distrigraph(occ_date, ptype=&quot;efforts&quot;, type=&quot;h&quot;)

</pre>
<p>Now this created the following graph:</p>
<p><img sizes="(max-width: 490px) 100vw, 490px" alt="BirdDistriPlot1" class="wp-image-483" src="https://i1.wp.com/vijaybarve.files.wordpress.com/2016/06/birddistriplot1.jpeg?w=456&ssl=1" data-recalc-dims="1"></p>
<p>The graph shows what we wanted to show, but we would like to modify this a bit to look more that the Figure in the paper. So let us exclude some more data and change the color and width of the lines in the graph.</p>
<pre>
occ_date1 &lt;- occ[occ$Date_collected > as.Date(&quot;1900-01-01&quot;) &amp;
               occ$Date_collected &lt; as.Date(&quot;2015-01-01&quot;) &amp;
               !is.na(occ$Date_collected) ,]
distrigraph(occ_date1, ptype=&quot;efforts&quot;, col=&quot;red&quot;,
            type=&quot;h&quot;, lwd=3)
</pre>
<p>Now this created the following graph:</p>
<p><img sizes="(max-width: 490px) 100vw, 490px" alt="BirdDistriPlot2" class="wp-image-491" src="https://i2.wp.com/vijaybarve.files.wordpress.com/2016/06/birddistriplot21.jpeg?w=456&ssl=1" data-recalc-dims="1"></p>
<p><strong>References</strong></p>
<ul>
<li>Asase, Alex, and A Townsend Peterson. 2016. “Completeness of Digital Accessible Knowledge of Plants of Ghana.” Biodiversity Informatics, 1–11. doi:<a target="_blank" rel="nofollow" href="http://dx.doi.org/10.17161/bi.v11i0.5860">http://dx.doi.org/10.17161/bi.v11i0.5860</a>.</li>
<li>Barve, Vijay, and Javier Otegui. 2016. “Bdvis: Visualizing Biodiversity Data in R.” Bioinformatics. doi:<a target="_blank" rel="nofollow" href="http://dx.doi.org/10.1093/bioinformatics/btw333">http://dx.doi.org/10.1093/bioinformatics/btw333</a>.</li>
</ul>
<p> <a target="_blank" rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/vijaybarve.wordpress.com/429/"><img alt="" src="http://feeds.wordpress.com/1.0/comments/vijaybarve.wordpress.com/429/" border="0"></a> <img alt="" src="https://i1.wp.com/pixel.wp.com/b.gif?resize=1%2C1&ssl=1" border="0" data-recalc-dims="1"></p>
<p><div><div><div><div data-width="55" data-show-faces="false" data-send="true" data-layout="box_count" data-height="62" data-href="https://www.r-bloggers.com/creating-figures-like-the-paper-completeness-of-digital-accessible-knowledge-of-plants-of-ghana-part-1/"></div></div><div><a data-url="https://www.r-bloggers.com/creating-figures-like-the-paper-completeness-of-digital-accessible-knowledge-of-plants-of-ghana-part-1/" data-counturl="https://www.r-bloggers.com/creating-figures-like-the-paper-completeness-of-digital-accessible-knowledge-of-plants-of-ghana-part-1/" data-count="vertical" data-text="Creating figures like the paper ‘Completeness of Digital Accessible Knowledge of Plants of Ghana’ Part 1" class="twitter-share-button" data-via="rbloggers" href="https://twitter.com/share"></a></div><div></div></div><div></div></div>
<div>
<div>To <strong>leave a comment</strong> for the author, please follow the link and comment on their blog: <strong><a href="https://vijaybarve.wordpress.com/2016/10/27/creating-figures-like-the-paper-completeness-of-digital-accessible-knowledge-of-plants-of-ghana-part-1/"> Vijay Barve</a></strong>.</div>
<hr>
<a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers.com</a> offers <strong><a rel="nofollow" href="https://feedburner.google.com/fb/a/mailverify?uri=RBloggers">daily e-mail updates</a></strong> about <a title="The R Project for Statistical Computing" rel="nofollow" href="https://www.r-project.org/">R</a> news and <a title="R tutorials" rel="nofollow" href="https://www.r-bloggers.com/?s=tutorial">tutorials</a> on topics such as: <a title="Data science" rel="nofollow" href="https://www.r-bloggers.com/?s=data%20science">Data science</a>, <a title="Big Data" rel="nofollow" href="https://www.r-bloggers.com/?s=Big%20Data">Big Data, <a title="R jobs" rel="nofollow" href="https://www.r-users.com/">R jobs</a>, visualization (<a title="ggplot and ggplot2 tutorials" rel="nofollow" href="https://www.r-bloggers.com/?s=ggplot2">ggplot2</a>, <a title="Boxplots using lattice and ggplot2 tutorials" rel="nofollow" href="https://www.r-bloggers.com/?s=boxplot">Boxplots</a>, <a title="Maps and gis" rel="nofollow" href="https://www.r-bloggers.com/?s=map">maps</a>, <a title="Animation in R" rel="nofollow" href="https://www.r-bloggers.com/?s=animation">animation</a>), programming (<a title="RStudio IDE for R" rel="nofollow" href="https://www.r-bloggers.com/?s=RStudio">RStudio</a>, <a title="Sweave and literate programming" rel="nofollow" href="https://www.r-bloggers.com/?s=sweave">Sweave</a>, <a title="LaTeX in R" rel="nofollow" href="https://www.r-bloggers.com/?s=LaTeX">LaTeX</a>, <a title="SQL and databases" rel="nofollow" href="https://www.r-bloggers.com/?s=SQL">SQL</a>, <a title="Eclipse IDE for R" rel="nofollow" href="https://www.r-bloggers.com/?s=eclipse">Eclipse</a>, <a title="git and github, Version Control System" rel="nofollow" href="https://www.r-bloggers.com/?s=git">git</a>, <a title="Large data in R using Hadoop" rel="nofollow" href="https://www.r-bloggers.com/?s=hadoop">hadoop</a>, <a title="Web Scraping of google, facebook, yahoo, twitter and more using R" rel="nofollow" href="https://www.r-bloggers.com/?s=Web+Scraping">Web Scraping</a>) statistics (<a title="Regressions and ANOVA analysis tutorials" rel="nofollow" href="https://www.r-bloggers.com/?s=regression">regression</a>, <a title="principal component analysis tutorial" rel="nofollow" href="https://www.r-bloggers.com/?s=PCA">PCA</a>, <a title="Time series" rel="nofollow" href="https://www.r-bloggers.com/?s=time+series">time series</a>, <a title="finance trading" rel="nofollow" href="https://www.r-bloggers.com/?s=trading">trading</a>) and more...
<img height="1" alt="" width="1" src="http://feeds.feedburner.com/~r/RBloggers/~4/y6NP2eGKFWs"></a></div>