I'm having issues with changing the size of the title, X-Y labels, X-Y axis text for my ggplot2
. I'm using ggsave
to save the plot as a jpg.
p <- ggplot()
p + theme(axis.title = element_text(size=30), axis.text.y = element_text(size=30),
axis.text.x = element_text(size=30))
but changing the sizes of these texts doesn't change anything on the plot. Would anyone know how to properly change the text sizes?
So I fixed the issue I was having so the changes I make to theme are not affecting the plot (I've tested with changing text color), however the size of the axis text still does not change.
p <- ggplot(d[d$user==i,], aes(x=date, y=url, group=user, label=user)) + geom_line() + geom_point() +
labs(list(title=i, x="Date and Time", y = "URL")) + # Plot labels
axis.POSIXct(1, at=seq(daterange[1], daterange[2], by="hour")) # Set x axis range to first and last date-time in data
p <- p + modifiedtheme
ggsave(plot = p, filename = "sample.jpg", height=2, width=6)
ggsave
you are using? Are you saving the final p,p <- p + theme(...)
before jpg'ing?ggsave
will save the last plot displayed, but it would be better to be explicit with the object – rawrp
, but does not actually change the objectp
. So when you savep
, you are saving the thing that was created earlier. If you want to save the version of the plot with altered text size, you need to assign it to an object, and then save that object. – Matt74