I have started using ggplot because I heard it's a lot more flexible and looks a lot better than the native plot function. However, my results ggplot graph looks worse than plot function so I must be doing something wrong. For example, the labels are too small to be legible, the line does not have any points on it, and the ratio just looks better with the default plot function. I am new to data visualization, so any guide or suggestions to making the graph look better would be much appreciated.
With plot:
plot(table(month(data$DATE)), type="b",
main="Time vs. Freq",
xaxt='n',
xlab="Month",
ylab="Frequency")
axis(1, at=1:9, labels = month.name[1:9])

With ggplot:
x <- month(data$DATE)
df = data.frame(x)
df$y <- 1
ggplot(df, aes(x, y)) + stat_summary(fun.y = sum, geom = "line") + xlab("Month") + ylab("Freq") + ggtitle("Time vs. Freq")

It's not completely clear what you don't like about the default ggplot2 plots but have you tried one of the other themes?
p <- ggplot(df, aes(x, y)) + stat_summary(fun.y = sum, geom = "line") +
xlab("Month") + ylab("Freq") + ggtitle("Time vs. Freq")
p + theme_bw() # For black/white publications plots
Or grab more themes and experience
install.packages("ggthemes")
library(ggthemes)
p + theme_tufte() # Based on Tufte's ideas
p + theme_stata() # Resembles plots from stata
p + theme_economist() # A la plots in the economist
just to show a few examples. And they can be tweaked as you please
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With