mirror of
https://github.com/dchakro/ggplot_themes.git
synced 2026-05-17 11:22:16 -07:00
Add README and example R code.
This commit is contained in:
parent
accf6b4ff0
commit
d9b9fbc97d
3 changed files with 79 additions and 0 deletions
38
source.R
Normal file
38
source.R
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
rm(list=ls())
|
||||
set.seed(100)
|
||||
a <- rnorm(50,mean = 50,sd = 1)
|
||||
b <- rnorm(50,mean = 0,sd = 1)
|
||||
dat <- data.frame(X=a,Y=b)
|
||||
dat$Class <- sample(x = c("beta","alpha"),size = 10,replace = T)
|
||||
|
||||
library(ggplot2)
|
||||
|
||||
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("Default theme")
|
||||
ggsave("~/Desktop/tmp/1.png",width = 6,height = 5,dpi = "print")
|
||||
|
||||
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("ggplot2::theme_bw")+theme_bw()
|
||||
ggsave("~/Desktop/tmp/2.png",width = 6,height = 5,dpi = "print")
|
||||
|
||||
source("https://gitlab.utu.fi/deecha/ggplot_themes/-/raw/master/DC_theme_generator.R")
|
||||
|
||||
customtheme <- DC_theme_generator(type='L')
|
||||
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("DC_theme_generator('L')")+customtheme
|
||||
ggsave("~/Desktop/tmp/3.png",width = 6,height = 5,dpi = "print")
|
||||
|
||||
customtheme <- DC_theme_generator(type='square')
|
||||
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("DC_theme_generator('square')")+customtheme
|
||||
ggsave("~/Desktop/tmp/4.png",width = 6,height = 5,dpi = "print")
|
||||
|
||||
|
||||
|
||||
|
||||
customtheme <- DC_theme_generator(type = 'L',
|
||||
legend = 'F',
|
||||
ticks = 'in',
|
||||
x.axis.angle = 45,
|
||||
hjust = 0.5,
|
||||
vjust = 0.5,
|
||||
fontsize.cex = 1.8,
|
||||
fontfamily = 'mono')
|
||||
|
||||
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
|
||||
Loading…
Add table
Add a link
Reference in a new issue