Question

So I am trying to enlarge and save a number of plots in R as png. I have been able to save the enlarged plots themselves, but the text on those plots is still too small. To account for this, I have tried setting:

par( ps = 12, cex = 1.33, cex.main = 1.33 )

Before calling for:

png( "Fig1_resize.png", width=300, height=300, units="mm", res=300 )

followed by the plot command - for example:

plot( RPCA$sdev^2/sum(RPCA$sdev^2), xlab="Component number", 
     ylab="Fraction of Variance", type="s" )

Then I just save that to my computer with:

dev.off()

The font in the plot that R returns is enlarged, but not the font in the saved plot. How can I save enlarged text plots with R?

Thanks for your help

Was it helpful?

Solution

I would start by increasing the base pointsize of the plot. See ?png and note the details of the pointsize argument, which defaults to 12. Hence I would try:

png("Fig1_resize.png", width=300, height=300, units="mm", res=300,
    pointsize = 14)
....
dev.off()

and increase the assigned value of pointsize until you get something that is acceptable for your needs.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top