Skip to content

Commit da5ed6f

Browse files
authored
Update R_specific.md
Added snippet for black theme using ggplot.
1 parent c49fc53 commit da5ed6f

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

R_specific.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,30 @@ plot(iris$Sepal.Length,iris$Sepal.Width, ylab = "Sepal Width",
3838
text(iris$Sepal.Length,iris$Sepal.Width,iris$Species,pos=3,offset=.2,col="darkgreen",cex=0.5)
3939
```
4040

41+
---
42+
**Dark theme using ggplot**
43+
44+
![alt text](images/ggplot_theme_black.png)
45+
46+
```r
47+
theme_black <- theme(plot.background = element_rect(fill = "black",colour=NA),
48+
panel.grid.major = element_blank(),
49+
text = element_text(color="white"),
50+
axis.title = element_text(colour = "white",size = 20),
51+
axis.text = element_text(colour = "white",size = 20),
52+
axis.line = element_line(colour = "white"),
53+
plot.title = element_text(color = "white"),
54+
panel.background = element_rect(fill = 'black'),
55+
legend.background = element_rect(fill = "black", color = NA),
56+
legend.key = element_rect(color = "black", fill = "gray"),
57+
legend.title = element_text(color = "white"),
58+
legend.text = element_text(color = "white",size = 20))
59+
60+
ggplot(iris,aes(x=Sepal.Length,y=Sepal.Width,color=Species))+
61+
geom_point()+theme_black
62+
63+
```
64+
4165
---
4266
**Dual axis**
4367

0 commit comments

Comments
 (0)