Re: How do I make all of the text bigger?

807 views
Skip to first unread message

Ben Bond-Lamberty

unread,
Feb 7, 2013, 10:48:35 AM2/7/13
to ggplot2
One quick way is to use ggplot's native method to save graphs:

ggsave('iris.plot.png')

...which gives a much more readable output, at least on my system. If
that's not enough, look at ?theme().

Ben


On Thu, Feb 7, 2013 at 10:09 AM, Thomas Levine <thomas...@gmail.com> wrote:
> I want to make all of the text bigger (so that I can make a
> higher-resolution raster image with legible text). Is there a concise way to
> do that?
>
> As an example of why I want to do this, here's a big plot whose text you can
> hardly read because it is so small.
>
> png('iris.plot.png', width = 1000, height = 1000)
> print(ggplot(iris) + aes(x = Sepal.Length, y = Sepal.Width) + geom_point())
> dev.off()
>
> Thanks
>
> --
> --
> You received this message because you are subscribed to the ggplot2 mailing
> list.
> Please provide a reproducible example:
> https://github.com/hadley/devtools/wiki/Reproducibility
>
> To post: email ggp...@googlegroups.com
> To unsubscribe: email ggplot2+u...@googlegroups.com
> More options: http://groups.google.com/group/ggplot2
>
> ---
> You received this message because you are subscribed to the Google Groups
> "ggplot2" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ggplot2+u...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

Greg Snow

unread,
Feb 7, 2013, 1:20:16 PM2/7/13
to Thomas Levine, ggplot2
Instead of thinking about this in terms of making the text bigger, think about making the final result the correct size and resolution.  Generally when people complain about the text in a plot being too small it is because they create a plot, then use it at a smaller size (either the viewer shrinks it or they insert it in a new document at a reduced size).  R is a great program, but it has troubles reading minds about how a graphic will be used/viewed.  So when you tell it that the final size will be 1000/72 inches high/wide it takes you at your word and chooses the font to be the same size as text when viewing the graphic at it's nearly 14 inch by 14 inch size.  When whatever you are using to view the graph shrinks this down (since most pieces of paper won't fit this) the text is shrunken as well.  

Better is to think ahead of time that you want a final graphic that is readable at 3 inches by 3 inches (or 7 cm by 7cm , or whatever you want) and you want good resolution then change your call to png to something like:

png('iris.plot.png', width=3, height=3, units='in', res=300)

or

png('iris.plot.png', width=900, height=900, res=300)

Then the text should be the correct size when viewed/printed at the final size.


On Thu, Feb 7, 2013 at 8:09 AM, Thomas Levine <thomas...@gmail.com> wrote:
I want to make all of the text bigger (so that I can make a higher-resolution raster image with legible text). Is there a concise way to do that?

As an example of why I want to do this, here's a big plot whose text you can hardly read because it is so small.

png('iris.plot.png', width = 1000, height = 1000)
print(ggplot(iris) + aes(x = Sepal.Length, y = Sepal.Width) + geom_point())
dev.off()

Thanks

--
--
You received this message because you are subscribed to the ggplot2 mailing list.
Please provide a reproducible example: https://github.com/hadley/devtools/wiki/Reproducibility
 
To post: email ggp...@googlegroups.com
To unsubscribe: email ggplot2+u...@googlegroups.com
More options: http://groups.google.com/group/ggplot2
 
---
You received this message because you are subscribed to the Google Groups "ggplot2" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ggplot2+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 



--
Gregory (Greg) L. Snow Ph.D.
538...@gmail.com

Winston Chang

unread,
Feb 7, 2013, 3:18:10 PM2/7/13
to Thomas Levine, ggplot2
You can specify base_size with theme_grey or theme_bw:
ggplot(iris) + aes(x = Sepal.Length, y = Sepal.Width) + geom_point() +
  theme_grey(base_size=20)

Or you can modify the base text size of the current theme:
ggplot(iris) + aes(x = Sepal.Length, y = Sepal.Width) + geom_point() +
   theme(text = element_text(size=20))


Thomas Levine

unread,
Feb 7, 2013, 6:39:40 PM2/7/13
to ggp...@googlegroups.com
OMG png(res = res) is going to change my life! ggsave too!

Thanks
Reply all
Reply to author
Forward
0 new messages