[R] ggplot2 font size problem

hadley wickham h.wickham at gmail.com
Tue Aug 12 00:38:12 CEST 2008


On Mon, Aug 11, 2008 at 1:24 PM, dhzdhz <myjunkbox at gmail.com> wrote:
>
> x=c("abcdefghijklmn", "opqrstuvwxyz")
> y=c(1, 2)
> df=data.frame(name=x, value=y)
> p=ggplot(df, aes(name, value))+geom_point()
> grid.gedit(gPath("xaxis"), gp=gpar(fontsize=8))
> print(p)
>
> It doesn't work. I have to print(p) before I change the font size.
> Furthermore, this change will be overwritten by default if I print(p) again.
> And the worst is that it works very ugly in y axis.
>
> Instead
>
> p=ggplot(df, aes(name, value))+geom_point()
>
> I used
>
> p=ggplot(df, aes(value, name))+geom_point()
> grid.gedit(gPath("yaxis"), gp=gpar(fontsize=8))
>
> The whole label and ticks are moved left due to smaller fonts. However, the
> figure doesn't. And now the ticks and labels are detached from the axis.
>
> Can I change the default setting?

That unfortunately is the best you can do in the current version.
This should be much improved in the next version which will be out
probably in around a month or so.

Hadley


-- 
http://had.co.nz/



More information about the R-help mailing list