<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/ggplot2-themes-examples/"></div></div><div><a data-url="https://www.r-bloggers.com/ggplot2-themes-examples/" data-counturl="https://www.r-bloggers.com/ggplot2-themes-examples/" data-count="horizontal" data-text="ggplot2 themes examples" 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://datascienceplus.com/ggplot2-themes-examples/"> DataScience+</a></strong>, and kindly contributed to <a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers)</a> </div>
<p>This short post is exactly what it seems: a showcase of all <code>ggplot2</code> themes available within the <code>ggplot2</code> package. I was doing such a list for myself (you know that feeling …”how would it look like with this theme? let’s try this one…”) and at the end I thought it could have be useful for my readers. At least this post will save you the time of trying all different themes just to have a sense of how they look like.<br>
Enjoy!</p>
<h3>theme_bw()</h3>
<p><a title="" data-rel="lightbox-0" target="_blank" href="https://i2.wp.com/datascienceplus.com/wp-content/uploads/2016/08/theme_bw.png"><img sizes="(max-width: 490px) 100vw, 490px" alt="theme_bw" class="wp-image-4542" src="https://i2.wp.com/datascienceplus.com/wp-content/uploads/2016/08/theme_bw-490x245.png?resize=456%2C228" data-recalc-dims="1"></a></p>
<h3>theme_classic()</h3>
<p><a title="" data-rel="lightbox-1" target="_blank" href="https://i0.wp.com/datascienceplus.com/wp-content/uploads/2016/08/theme_classic.png"><img sizes="(max-width: 490px) 100vw, 490px" alt="theme_classic" class="wp-image-4543" src="https://i2.wp.com/datascienceplus.com/wp-content/uploads/2016/08/theme_classic-490x245.png?resize=456%2C228" data-recalc-dims="1"></a></p>
<h3>theme_dark()</h3>
<p><a title="" data-rel="lightbox-2" target="_blank" href="https://i0.wp.com/datascienceplus.com/wp-content/uploads/2016/08/theme_dark.png"><img sizes="(max-width: 490px) 100vw, 490px" alt="theme_dark" class="wp-image-4544" src="https://i2.wp.com/datascienceplus.com/wp-content/uploads/2016/08/theme_dark-490x245.png?resize=456%2C228" data-recalc-dims="1"></a></p>
<h3>theme_get()</h3>
<p><a title="" data-rel="lightbox-3" target="_blank" href="https://i2.wp.com/datascienceplus.com/wp-content/uploads/2016/08/theme_get.png"><img sizes="(max-width: 490px) 100vw, 490px" alt="theme_get" class="wp-image-4545" src="https://i2.wp.com/datascienceplus.com/wp-content/uploads/2016/08/theme_get-490x245.png?resize=456%2C228" data-recalc-dims="1"></a></p>
<h3>theme_gray()</h3>
<p><a title="" data-rel="lightbox-4" target="_blank" href="https://i1.wp.com/datascienceplus.com/wp-content/uploads/2016/08/theme_gray.png"><img sizes="(max-width: 490px) 100vw, 490px" alt="theme_gray" class="wp-image-4546" src="https://i0.wp.com/datascienceplus.com/wp-content/uploads/2016/08/theme_gray-490x245.png?resize=456%2C228" data-recalc-dims="1"></a></p>
<h3>theme_grey()</h3>
<p><a title="" data-rel="lightbox-5" target="_blank" href="https://i0.wp.com/datascienceplus.com/wp-content/uploads/2016/08/theme_grey.png"><img sizes="(max-width: 490px) 100vw, 490px" alt="theme_grey" class="wp-image-4547" src="https://i2.wp.com/datascienceplus.com/wp-content/uploads/2016/08/theme_grey-490x245.png?resize=456%2C228" data-recalc-dims="1"></a></p>
<h3>theme_light()</h3>
<p><a title="" data-rel="lightbox-6" target="_blank" href="https://i2.wp.com/datascienceplus.com/wp-content/uploads/2016/08/theme_light.png"><img sizes="(max-width: 490px) 100vw, 490px" alt="theme_light" class="wp-image-4548" src="https://i2.wp.com/datascienceplus.com/wp-content/uploads/2016/08/theme_light-490x245.png?resize=456%2C228" data-recalc-dims="1"></a></p>
<h3>theme_linedraw()</h3>
<p><a title="" data-rel="lightbox-7" target="_blank" href="https://i2.wp.com/datascienceplus.com/wp-content/uploads/2016/08/theme_linedraw.png"><img sizes="(max-width: 490px) 100vw, 490px" alt="theme_linedraw" class="wp-image-4549" src="https://i0.wp.com/datascienceplus.com/wp-content/uploads/2016/08/theme_linedraw-490x245.png?resize=456%2C228" data-recalc-dims="1"></a></p>
<h3>theme_minimal()</h3>
<p><a title="" data-rel="lightbox-8" target="_blank" href="https://i0.wp.com/datascienceplus.com/wp-content/uploads/2016/08/theme_minimal.png"><img sizes="(max-width: 490px) 100vw, 490px" alt="theme_minimal" class="wp-image-4550" src="https://i0.wp.com/datascienceplus.com/wp-content/uploads/2016/08/theme_minimal-490x245.png?resize=456%2C228" data-recalc-dims="1"></a></p>
<h2>Bonus Track: The Code</h2>
<p>Since copy and pasting and right-clicking 9 times to produce all the plots was definitely not acceptable, I wrote a small function to dynamically create and save a png file with different name and content.</p>
<pre>
library(dplyr) #data manipulation
library(ggplot2) #data visualization

create_file &lt;- function(name){
  path % file.path() %>% png(,width=960,height=480)
}

#this is the template: change the theme (and the name argument) to produce the other plots
create_file(name = &quot;theme_bw&quot;)
ggplot(data=diamonds, aes(carat,price ))+
  geom_point(aes(colour= color))+
  theme_bw()
dev.off()
</pre>
<h3>Final notes</h3>
<p>Inner ggplot2 structure allows for a nearly infinite number of customizations and extensions.You can have a sense of what I am talking about looking at <a target="_blank" rel="nofollow" href="http://www.ggplot2-exts.org/">ggplot2 extensions</a> website or to the <a target="_blank" rel="nofollow" href="https://cran.r-project.org/web/packages/ggthemes/vignettes/ggthemes.html">ggthemes package vignette</a> by the package author Jeffrey B. Arnold.</p>
<ul></ul>
<p><strong>
<p>Related Post</p>
<p>
<ol>
<li><a title="Permanent Link toMap the Life Expectancy in United States with data from Wikipedia" target="_blank" rel="bookmark" href="http://datascienceplus.com/map-the-life-expectancy-in-united-states-with-data-from-wikipedia/">Map the Life Expectancy in United States with data from Wikipedia</a></li>
<li><a title="Permanent Link toWhat can we learn from the statistics of the EURO 2016 – Application of factor analysis" target="_blank" rel="bookmark" href="http://datascienceplus.com/what-can-we-learn-from-the-statistics-of-the-euro-2016-application-of-factor-analysis/">What can we learn from the statistics of the EURO 2016 – Application of factor analysis</a></li>
<li><a title="Permanent Link toVisualizing obesity across United States by using data from Wikipedia" target="_blank" rel="bookmark" href="http://datascienceplus.com/visualizing-obesity-across-united-states-by-using-data-from-wikipedia/">Visualizing obesity across United States by using data from Wikipedia</a></li>
<li><a title="Permanent Link toPlotting App for ggplot2 – Part 2" target="_blank" rel="bookmark" href="http://datascienceplus.com/plotting-app-for-ggplot2-part-2/">Plotting App for ggplot2 – Part 2</a></li>
<li><a title="Permanent Link toMastering R plot – Part 3: Outer margins" target="_blank" rel="bookmark" href="http://datascienceplus.com/mastering-r-plot-part-3-outer-margins/">Mastering R plot – Part 3: Outer margins</a></li>
</ol></strong>
<div>
<a target="_blank" href="http://feeds.feedburner.com/~ff/datascienceplus?a=QNIJCx95hKo:34hh4FJwI7A:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/datascienceplus?i=QNIJCx95hKo:34hh4FJwI7A:D7DqB2pKExk" border="0"></a> <a target="_blank" href="http://feeds.feedburner.com/~ff/datascienceplus?a=QNIJCx95hKo:34hh4FJwI7A:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/datascienceplus?d=qj6IDK7rITs" border="0"></a> <a target="_blank" href="http://feeds.feedburner.com/~ff/datascienceplus?a=QNIJCx95hKo:34hh4FJwI7A:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/datascienceplus?d=yIl2AUoC8zA" border="0"></a>
</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/ggplot2-themes-examples/"></div></div><div><a data-url="https://www.r-bloggers.com/ggplot2-themes-examples/" data-counturl="https://www.r-bloggers.com/ggplot2-themes-examples/" data-count="vertical" data-text="ggplot2 themes examples" 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://datascienceplus.com/ggplot2-themes-examples/"> DataScience+</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/ZImt1Ys9ZXU"></a></div>