Change Text Size of Chart Labels of facet_grid

803 views
Skip to first unread message

Idris Raja

unread,
Sep 14, 2011, 6:03:10 PM9/14/11
to ggp...@googlegroups.com
I've tried a few options in opts(), including:

legend.title
legend.text
plot.title

What is the option for reducing the text font size for the labels of a facet when using facet_wrap. I've circled the text which I want to reduce the size of in the picture attached.

Thanks

On Wed, Sep 14, 2011 at 2:43 PM, John McCallum <John.M...@plantandfood.co.nz> wrote:

Thanks a lot Hadley & Juan for pointing me in the right direction… this was of course trivial once I had understood the proper use of HEX+ scale_color_identity()

Reproducible version attached..

 

Regards & many thanks

John

 

 

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 

##testing ggplot plotting of LAB colours

library(colorspace)

 

rawdata=structure(list(Lstar = c(35.1, 30.61, 37.81, 43.91, 31.22, 42.97,

30.32, 37.61, 39.24, 49.63, 31.66, 27.32, 42.19, 49.11, 70.49,

39.49, 43.98, 36.58, 36.74, 42.33, 33.02, 34.03, 30.13, 34.54,

30.91, 31.5, 37.7, 21.03, 29.51, 44.31), Astar = c(21.58, 24.82,

20.18, 13.53, 26.3, 22.04, 26.49, 24.78, 21.73, 8.9, 28.69, 28.32,

20.52, 12.66, -6.91, 20.25, 21.21, 23.48, 25.1, 18.38, 22.4,

23.23, 30.8, 21.1, 32.8, 29.82, 25.52, 27.39, 27.96, 19.32),

    Bstar = c(-8.7, -7.96, -6.61, -2.95, -8.89, -8.07, -9.22,

    -8.92, -7.7, -1.37, -9.09, -9.1, -7.35, -4.27, 20.78, -6.24,

    -7.64, -8.01, -9.2, -5.15, -6.06, -8.04, -8.88, -6.39, -9.99,

    -9.22, -9.81, -3.83, -7.96, -7.28)), .Names = c("Lstar",

"Astar", "Bstar"), row.names = c(NA, 30L), class = "data.frame")

 

##convert to colors of class LAB

LABdata=with(rawdata,LAB(Lstar,Astar,Bstar))

 

##plot using generic plot

plot(as(LABdata,"LAB"))

 

##plot using ggplot2

ggplot(rawdata, aes(x=Astar, y=Bstar)) + geom_point(size=5, aes(colour=hex(LABdata,fix = TRUE))) +scale_color_identity() + opts(legend.position = "none")

 

#

# > sessionInfo()

# R version 2.13.1 (2011-07-08)

# Platform: i386-pc-mingw32/i386 (32-bit)

#

# locale:

# [1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252    LC_MONETARY=English_United States.1252

# [4] LC_NUMERIC=C                           LC_TIME=English_United States.1252   

#

# attached base packages:

# [1] grid      stats     graphics  grDevices utils     datasets  methods   base    

#

# other attached packages:

# [1] lattice_0.19-30  ggplot2_0.8.9    proto_0.3-9.2    reshape_0.8.4    plyr_1.6         colorspace_1.1-0

#

# loaded via a namespace (and not attached):

# [1] digest_0.5.0 tools_2.13.1

The contents of this e-mail are confidential and may be subject to legal privilege.
 If you are not the intended recipient you must not use, disseminate, distribute or
 reproduce all or any part of this e-mail or attachments.  If you have received this
 e-mail in error, please notify the sender and delete all material pertaining to this
 e-mail.  Any opinion or views expressed in this e-mail are those of the individual
 sender and may not represent those of The New Zealand Institute for Plant and
 Food Research Limited.

--
You received this message because you are subscribed to the ggplot2 mailing list.
Please provide a reproducible example: http://gist.github.com/270442
 
To post: email ggp...@googlegroups.com
To unsubscribe: email ggplot2+u...@googlegroups.com
More options: http://groups.google.com/group/ggplot2

ggplot_example.PNG

Kohske Takahashi

unread,
Sep 14, 2011, 10:08:33 PM9/14/11
to Idris Raja, ggp...@googlegroups.com
Hi

What you are looking for is strip.text.x (strip.text.y).

--
Kohske Takahashi <takahash...@gmail.com>

Research Center for Advanced Science and Technology,
The University of  Tokyo, Japan.
http://www.fennel.rcast.u-tokyo.ac.jp/profilee_ktakahashi.html

Idris Raja

unread,
Sep 15, 2011, 1:34:03 PM9/15/11
to Kohske Takahashi, ggp...@googlegroups.com
strip.text.x did the trick. Thanks.
Reply all
Reply to author
Forward
0 new messages