If this is possible, I bet it is done by manually providing labels,
and then somehow using ?plotmath expressions rather than character
strings for those labels. The documentation, unfortunately, makes it
sound like only character strings work. I would love to be wrong
about that.
(Have I kvetched about the documentation recently? The reference page
for *every function* should document *every one of that function's
arguments* in enough detail that you could use them correctly even if
you had read *none* of the other documentation. Nearly all R built-in
documentation gets this right, but ggplot (and reshape) don't.)
zw
It's probably easiest with the tikzDevice device, where you could
encode LaTeX syntax in your axis labels. Something like,
library(ggplot2)
library(tikzDevice)
p = qplot(1:9, 1:9 * 1e3) +
scale_y_continuous(breaks= seq(1,9)*1e3, labels =
paste("\\textbf{",seq(1,9),"}000", sep=""))
tikz("test.tex", standAlone=TRUE)
print(p)
dev.off()
HTH,
baptiste
> --
> 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
>
Baptiste's solution seems pretty elegant to me. It is also possible
to do using expressions and some of the formatters from plotmath().
But possible does not equate to easy.
> If this is possible, I bet it is done by manually providing labels,
> and then somehow using ?plotmath expressions rather than character
> strings for those labels. The documentation, unfortunately, makes it
> sound like only character strings work. I would love to be wrong
> about that.
Well it's your lucky day then Zack ;) Here's an example:
qplot(1:10, 1:10, geom = "point") +
scale_x_continuous(breaks = c(1, 5, 10),
labels = expression(bold("1.")~0, bold("5.")~0, bold("10.")~0))
I am not very good at plotmath expressions...I've never really had to
do more than add the occasional Greek letter, so I'm not certain how
you can indicate separate elements without adding a space or anything
(hence my ~).
> (Have I kvetched about the documentation recently? The reference page
> for *every function* should document *every one of that function's
I suspect if you were to write some nice documentation and email it to
Hadley, he would gladly add it. I have (and still am) actually
considered this myself, but it is not as easy as it might seem.
Firstly, there is the non-trivial time required to do it. Secondly,
ggplot2 is somewhat unique, I think, in that virtually none of the
functions operate in isolation. This makes documenting them in
isolation difficult. To make an analogy, how would you describe what
a noun is and how to use a noun properly? A verb? A direct object?
Just like "ran" is a perfectly fine verb yet, "I will ran to the
store" is an incorrect sentence, so to certain functions are properly
or improperly used only within the context of the broader grammar of
graphics. This is certainly documentable, and it would be wonderful
if it was, but it is more difficult, I think, then just writing
definitions out argument by argument. I am personally of the opinion
that I would prefer Hadley's time, expertise, and overall genius to be
devoted towards development, which leaves documentation to others/the
community. I suppose one thing to consider is, would you like more
documentation even if it was incomplete/not perfect? It may be
helpful to have something even if it does not fully grasp the nuances
and how usage changes depending on the context. If so, with Hadley's
blessing, I would be willing to start on this, perhaps originally
through the wiki (so others can edit my errors), and then eventually
translate it into the documentation files?
> arguments* in enough detail that you could use them correctly even if
> you had read *none* of the other documentation. Nearly all R built-in
> documentation gets this right, but ggplot (and reshape) don't.)
>
> zw
>
> --
> 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
>
--
Joshua Wiley
Ph.D. Student, Health Psychology
University of California, Los Angeles
http://www.joshuawiley.com/
Definitely and great analogy!
Hadley
--
Assistant Professor / Dobelman Family Junior Chair
Department of Statistics / Rice University
http://had.co.nz/