Created
February 18, 2016 20:03
-
-
Save muschellij2/709b08acbbb9b6c5a85f to your computer and use it in GitHub Desktop.
Plot for https://hopstat.wordpress.com/2016/02/18/how-i-build-up-a-ggplot2-figure/ better ggplot2 plot
This file contains 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
## ----plot---------------------------------------------------------------- | |
library(ggplot2) | |
ggplot(data = quakes, aes(x = lat,y = long,colour = stations)) + geom_point() | |
## ----save_plot----------------------------------------------------------- | |
g = ggplot(data = quakes, | |
aes(x = lat,y = long,colour = stations)) + | |
geom_point() + | |
xlab("Latitude") + ylab("Longitude") + | |
theme_bw() + | |
theme(axis.text = element_text(size = 18), | |
axis.title = element_text(size = 20), | |
legend.text = element_text(size = 15), | |
legend.title = element_text(size = 15), | |
legend.position = c(0.3, 0.35), | |
legend.background = element_rect(fill = "transparent"), | |
legend.key = element_rect(fill = "transparent", | |
color = "transparent")) + | |
guides( | |
colour = guide_colorbar(title = "Number\nof\nStations\nReporting", | |
title.hjust = 0.5, | |
title.position = "left")) | |
print(g) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment