diff --git a/DC_theme_generator.R b/DC_theme_generator.R index b2104ef..9a173e8 100644 --- a/DC_theme_generator.R +++ b/DC_theme_generator.R @@ -1,4 +1,14 @@ -DC_theme_generator <- function(type, legend=T, ticks="out", x.axis.angle=0, hjust=0.5, vjust=0.5, fontsize.cex=1.5, fontfamily="serif", ax.fontstyle="bold.italic"){ +DC_theme_generator <- function(type, + legend = T, + ticks = "out", + x.axis.angle = 0, + hjust = 0.5, + vjust = 0.5, + fontsize.cex = 1.5, + fontfamily = "serif", + ax.fontstyle = "italic", + title.fontstyle = "bold.italic"){ + # #<----------------------------> # # You must include this section when: # # Distributing, Embedding, Using and/or Modifying this code. @@ -18,7 +28,7 @@ DC_theme_generator <- function(type, legend=T, ticks="out", x.axis.angle=0, hjus # legent: T = left, F = no legend # ticks: 'in', 'out' # fontfamily: 'serif' , 'sans' , 'mono', 'Helvetica', 'Palatino' - # ax.fontstyle = 'plain', 'italic', 'bold', 'bold.italic' + # title.fontstyle and ax.fontstyle = 'plain', 'italic', 'bold', 'bold.italic' # x.axis.angle = 45 (i.e. angle for the x axis text) # hjust and vjust = to adjust the x axis text @@ -37,7 +47,7 @@ DC_theme_generator <- function(type, legend=T, ticks="out", x.axis.angle=0, hjus axis.ticks = element_line(colour = "black"), text = element_text(family = fontfamily), plot.title = element_text(family = fontfamily, - face="bold", + face = title.fontstyle, color = "black", size = rel(fontsize.cex)), axis.ticks.length = unit(ifelse(ticks=="in",-0.2,0.2),"cm"), @@ -77,7 +87,7 @@ DC_theme_generator <- function(type, legend=T, ticks="out", x.axis.angle=0, hjus axis.ticks = element_line(colour = "black"), text = element_text(family = fontfamily), plot.title = element_text(family = fontfamily, - face="bold", + face = title.fontstyle, color = "black", size = rel(fontsize.cex)), axis.ticks.length = unit(ifelse(ticks=="in",-0.2,0.2), "cm"), diff --git a/theme_dc.plot.L.45.nolegend.R b/theme_dc.plot.L.45.nolegend.R index 33e471f..e5524a1 100644 --- a/theme_dc.plot.L.45.nolegend.R +++ b/theme_dc.plot.L.45.nolegend.R @@ -1,5 +1,9 @@ # This is legacy theme defination for maintaining compatibility with my own historical code base. +warning("This is legacy code. Please migrate to: https://github.com/dchakro/ggplot_themes") +message("Please run:") +message("source('https://raw.githubusercontent.com/dchakro/ggplot_themes/master/DC_theme_generator.R')") + library(ggplot2) theme_dc.plot.L.45.nolegend=ggplot2::theme( axis.line = element_line(colour = "black",