update description

This commit is contained in:
dchakro 2020-08-25 18:02:35 +03:00
parent 138478394c
commit fe72db0a85
4 changed files with 23 additions and 12 deletions

View file

@ -1,18 +1,28 @@
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"){
# #<---------------------------->
# # You must include this section when:
# # Distributing, Embedding, Using and/or Modifying this code.
# # Please read and abide by the terms of the included LICENSE.
# # Copyright 2020, Deepankar Chakroborty, All rights reserved.
# # Generate themes for ggplot2
# # Author: Deepankar Chakroborty
# # Available at: https://github.com/dchakro/ggplot_themes
# # Report issues: https://github.com/dchakro/ggplot_themes/issues
# # LICENSE: https://github.com/dchakro/ggplot_themes/blob/master/LICENSE
# #<---------------------------->
## Options:
# # PURPOSE: Generate themes for ggplot2
# # OPTIONS:
# type: 'L', 'square'
# legent: T = left, F = no legend
# ticks: 'in', 'out'
# fontfamily: 'serif' , 'sans' , 'mono', 'Helvetica', 'Palatino'
# 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
ticks <- tolower(ticks)
# Supports system fonts, and doesn't transform them to lower case as font names are case-sensitive.
fontfamily <- ifelse(test = tolower(fontfamily) %in% c("sans","serif","mono"),yes = tolower(fontfamily),no = fontfamily)
if( type == "square"){

View file

@ -17,7 +17,7 @@ I found myself writing these ```ggplot2::theme()``` objects everytime I wanted t
## Using DC_theme_generator
```R
source("https://gitlab.utu.fi/deecha/ggplot_themes/-/raw/master/DC_theme_generator.R")
source('https://raw.githubusercontent.com/dchakro/ggplot_themes/master/DC_theme_generator.R')
customtheme <- DC_theme_generator(type='L')
ggplot()+geom_point()+customtheme
@ -28,15 +28,16 @@ More detailed usage instructions along with an example can be found in the R scr
Here is an example tweaking some of the defaults:
```R
source("https://gitlab.utu.fi/deecha/ggplot_themes/-/raw/master/DC_theme_generator.R")
source('https://raw.githubusercontent.com/dchakro/ggplot_themes/master/DC_theme_generator.R')
customtheme <- DC_theme_generator(type = 'L',
legend = 'F',
ticks = 'out',
ticks = 'in',
x.axis.angle = 45,
hjust = 0.5,
vjust = 0.5,
fontsize.cex = 1.8,
fontfamily = 'mono')
fontsize.cex = 1.5,
fontfamily = 'Palatino',
ax.fontstyle = "bold.italic")
ggplot(data = dat, aes(x=X,y=Y,color=Class)) + geom_point() + scale_color_manual(values=c("red","blue")) + xlab("X-axis") + ylab("Y-axis") + ggtitle("Customized DC_theme_generator") + customtheme
```

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Before After
Before After

View file

@ -32,8 +32,8 @@ customtheme <- DC_theme_generator(type = 'L',
x.axis.angle = 45,
hjust = 0.5,
vjust = 0.5,
fontsize.cex = 1.8,
fontfamily = 'mono',
fontstyle = "bold")
fontsize.cex = 1.5,
fontfamily = 'Palatino',
ax.fontstyle = "bold.italic")
ggplot(data = dat, aes(x=X,y=Y,color=Class)) + geom_point() + scale_color_manual(values=c("red","blue")) + xlab("X-axis") + ylab("Y-axis") + ggtitle("Customized DC_theme_generator") + customtheme