Crate your own theme with ggplot2

Published onesixx on

legend :

So basically a theme is just a function with a number of arguments set by default, such as background color, size and style of axis text and labels, legend, etc. Text style, legend, labels, background color, etc, are specified in the function theme(). Hence in order to create our own one, it is enough to define a function my_theme that calls the generic theme() function and where we define all the parameters as we like


  1. lightblue background
  2. a darker blue border around the plot
  3. only main dotted gridlines in a darkblue
  4. axis text in italic and darkblue
  5. all text in “Times New Roman” and darkblue
  6. legend at the bottom by default

opt = theme(legend.position = “none”,
panel.background = element_rect(fill=”white”),
axis.ticks = element_blank(),
panel.grid = element_blank(),
axis.title = element_blank(),
axis.text = element_blank())

Categories: ggplot2


Blog Owner

Leave a Reply

Your email address will not be published.