Last active
November 4, 2024 12:30
-
-
Save jacobhepkema/f89c5ac3acb74077ee4e88b3aff9b513 to your computer and use it in GitHub Desktop.
A nice theme for ggplots
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| theme_Nice <- | |
| function(base_size = 14, | |
| base_family = "Helvetica", | |
| angled = TRUE, | |
| show_legend = TRUE, | |
| axis_text_size = 14) { | |
| return( | |
| theme_bw(base_size = base_size, base_family = base_family) | |
| + theme( | |
| axis.text.x = element_text( | |
| angle = ifelse(angled, 45, 0), | |
| hjust = ifelse(angled, 1, 0.5), | |
| colour = "black", | |
| size = axis_text_size | |
| ), | |
| axis.text.y = element_text(colour = "black", size = axis_text_size), | |
| axis.line = element_line(colour = "black"), | |
| panel.grid.major = element_blank(), | |
| panel.grid.minor = element_blank(), | |
| panel.border = element_blank(), | |
| panel.background = element_blank(), | |
| legend.position = ifelse(show_legend, "right", "none"), | |
| legend.text = element_text(colour='black', size=14), | |
| strip.background = element_blank(), | |
| strip.text = element_text(colour = "black", size = 14), | |
| plot.title = element_text(size=14, hjust=0.5) | |
| ) | |
| ) | |
| } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
(updated to make title centered and same font size)