How to resize axis and legend text?

175 views
Skip to first unread message

Sérgio Nunes

unread,
Jan 22, 2010, 12:11:09 PM1/22/10
to ggplot2
Hi,

I'm trying to increase the size of the axes and the labels with a
simple parameter setup. The default is really small for a two column
paper layout. I am using:

theme_bw( base_size=20 )

It works as expected. However text is being printed outside of the PDF
canvas, more specifically it is being cropped on the right side.

How should I handle this?

Thanks in advance,
--
Sérgio Nunes

baptiste auguie

unread,
Jan 22, 2010, 12:56:43 PM1/22/10
to Sérgio Nunes, ggplot2
Hi,

I don't know about the cropping (could you post a minimal example to
demonstrate this?) but I'm surprised you'd use a font of 20 for a
paper. For a two column layout, I would typically save a 4-inch wide
figure with ggsave(..., width=4), keeping the font size to 10. Are you
maybe resizing the plot when you insert it in your document?

Best,

baptiste

2010/1/22 Sérgio Nunes <sergio...@gmail.com>:

> --
> You received this message because you are subscribed to the ggplot2 mailing list.
> To post to this group, send email to ggp...@googlegroups.com
> To unsubscribe from this group, send email to
> ggplot2+u...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/ggplot2

Sérgio Nunes

unread,
Jan 22, 2010, 1:11:43 PM1/22/10
to baptiste auguie, ggplot2
Thanks for the quick reply. I really appreciate it given my looming
deadline for this paper.
My procedure is the following:

In R, I prepare the PDFs using pdf("figs.pdf", width = 16, height = 9)
and then using ggplot or qplot with theme_bw( base_size=20 ) I plot
each chart. Given the nature of my figures, I tend to prefer this
"landscape" view.

In LaTeX, I simply include the figures with:

\begin{figure}
\centering
\includegraphics[page=13,width=0.9\columnwidth]{../plots/figs.pdf}
\end{figure}

I placed a PDF evidencing the problem here:
http://irlab.fe.up.pt/sandbox/cropped.pdf

Thanks again,
--
Sérgio Nunes

2010/1/22 baptiste auguie <bapt...@googlemail.com>:

baptiste auguie

unread,
Jan 22, 2010, 1:22:42 PM1/22/10
to Sérgio Nunes, ggplot2
My personal preference is to never let LaTeX resize the picture,
otherwise the font size is never really consistent in the document. In
this spirit I might also suggest the tikzDevice package, where LaTeX
actually processes the text itself in the figure so that its size
always matches the rest of the document. You'd have to create separate
files for each figure though.

Is there a particular reason you want a graphic of 16x9 inches and
not, say, 4x2.2?

Ista Zahn

unread,
Jan 22, 2010, 2:17:59 PM1/22/10
to baptiste auguie, Sérgio Nunes, ggplot2
I second the tikzDevice suggestion. I struggled for some time to get
graphics in LaTeX documents with the correct dimensions and font
faces/sizes, and tikzDevice is by far the best solution I've found.

-Ista

2010/1/22 baptiste auguie <bapt...@googlemail.com>:

--
Ista Zahn
Graduate student
University of Rochester
Department of Clinical and Social Psychology
http://yourpsyche.org

Reply all
Reply to author
Forward
0 new messages