Ggplots2 ggsave text size does not change

I'm having problems resizing the title, XY labels, XY axis text for my ggplot2 . I use ggsave to save the graph as 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 resizing these texts does not change anything on the chart. Does anyone know how to resize text correctly?


So, I fixed the problem that I encountered, so the changes that I make for the theme do not affect the plot (I tested with a change in the color of the text), however, the size of the axis text does not change anyway.

 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) 
+5
source share
1 answer

Here is a minimal, fully reproducible version of the problem (or the absence of any problem, as the comments noted). Your own published code seems correct, but perhaps this example will help you solve any real problem:

 library(ggplot2) p1 = ggplot(iris, aes(x=Sepal.Length, y=Sepal.Width, colour=Species)) + geom_point() p2 = ggplot(iris, aes(x=Sepal.Length, y=Sepal.Width, colour=Species)) + geom_point() + theme(axis.title=element_text(size=30)) ggsave("figure1.jpg", plot=p1, height=3, width=4, units="in", dpi=150) ggsave("figure2.jpg", plot=p2, height=3, width=4, units="in", dpi=150) 

enter image description here

+6
source

All Articles