<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/interactive-illustrator-quality-graphics-with-r/"></div></div><div><a data-url="https://www.r-bloggers.com/interactive-illustrator-quality-graphics-with-r/" data-counturl="https://www.r-bloggers.com/interactive-illustrator-quality-graphics-with-r/" data-count="horizontal" data-text="Interactive, Illustrator-quality graphics with R" 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="http://blog.revolutionanalytics.com/2016/08/interactive-illustrator-quality-graphics-with-r.html"> Revolutions</a></strong>, and kindly contributed to <a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers)</a> </div>
<div>
<p>While many media properties including the <a target="_blank" href="http://blog.revolutionanalytics.com/2015/10/amanda-cox-on-using-r-at-the-nyt.html">New York Times</a>, <a target="_blank" href="http://blog.revolutionanalytics.com/2016/07/data-journalism-with-r-at-538.html">FiveThirtyEight</a> and <a target="_blank" href="http://flowingdata.com/2016/03/08/what-i-use-to-visualize-data/">FlowingData</a> use the <a target="_blank" href="https://mran.microsoft.com/documents/what-is-r/">R language</a> to prepare graphics for publication, they often use Adobe Illustrator or similar graphics tools to touch up the last 5% or so of the graphics. Not so for Switzerland's news site swissinfo.ch, whose data journalist <a target="_blank" href="http://dqn.website/">Duc-Quang Nguyen</a> created these gorgeous bar charts showing the <a target="_blank" href="http://www.swissinfo.ch/eng/rio-2016-_swiss-olympians---the-solo-specialists-/42349156?utm_content=bufferd148b&utm_medium=social&utm_source=twitter.com&utm_campaign=buffer">representation of major countries in various categories of Olympic events in Rio</a>:</p>
<p><a target="_blank" href="http://www.swissinfo.ch/eng/rio-2016-_swiss-olympians---the-solo-specialists-/42349156?utm_content=bufferd148b&utm_medium=social&utm_source=twitter.com&utm_campaign=buffer"><img title="Olympics" alt="Olympics" src="http://revolution-computing.typepad.com/.a/6a010534b1db25970b01b8d20d7b91970c-800wi" border="0"></a></p>
<p>Note the use of an attractive colour pallette, style-compatible fonts, and even the official Olympic icons for the sports. I just took a screenshot here, but if you click through to the actual site you'll notice that these graphics are also scale-independent (you can zoom in on your browser and they'll look better, not worse) and even interactive (pop-ups appear with country-specific data when you hover over a bar).</p>
<p>Duc-Quang has been generous enough to provide the <a target="_blank" href="https://github.com/d-qn/2016_08_02_rioOlympicsAthletes">R code behind these charts</a> if you'd like to try your hand at something similar. The data themselves were <a target="_blank" href="https://github.com/d-qn/2016_08_02_rioOlympicsAthletes/blob/master/01_scrapeData.Rmd">scraped</a> from the <a target="_blank" href="https://www.rio2016.com/en/sports">official Rio 2016 site</a>. The bar charts were created using a standard <span>geom_bar</span> plot using <a target="_blank" href="http://ggplot2.org/">ggplot2</a>, with a custom theme to set the font to OpenSans Condensed. The interactive elements were added using the <a target="_blank" href="https://mran.microsoft.com/package/ggiraph/">ggiraph package</a> and the <span><a target="_blank" href="http://www.rdocumentation.org/packages/ggiraph/versions/0.3.1/topics/geom_bar_interactive">geom_bar_interactive</a></span> function. The chart titles (including the icons) were created as HTML headers directly, which was then exported along with the interactive charts using the <span><a target="_blank" href="http://www.rdocumentation.org/packages/htmltools/versions/0.3.5/topics/save_html">save_html</a></span> function.</p>
<p>Seriously, go back and take a look at all of the charts in their interactive glory by following the link below. Now that's how to elevate a simple bar chart into something gorgeous.</p>
<p>SWI swissinfo.ch: <a target="_blank" href="http://www.swissinfo.ch/eng/rio-2016-_swiss-olympians---the-solo-specialists-/42349156?utm_content=bufferd148b&utm_medium=social&utm_source=twitter.com&utm_campaign=buffer">Swiss Olympians – the solo specialists</a></p>
</div>
<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/interactive-illustrator-quality-graphics-with-r/"></div></div><div><a data-url="https://www.r-bloggers.com/interactive-illustrator-quality-graphics-with-r/" data-counturl="https://www.r-bloggers.com/interactive-illustrator-quality-graphics-with-r/" data-count="vertical" data-text="Interactive, Illustrator-quality graphics with R" 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="http://blog.revolutionanalytics.com/2016/08/interactive-illustrator-quality-graphics-with-r.html"> Revolutions</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/GU-bH008Ks4"></a></div>