geom_text and font fuzziness

404 views
Skip to first unread message

Johannes Graumann

unread,
Jun 25, 2010, 7:55:04 AM6/25/10
to ggplot2
Hi again,

If I do this:

> library(ggplot2)
> p <- ggplot(mtcars, aes(factor(cyl), mpg))
> p + geom_boxplot() + geom_text(aes(x=1,y=min(mtcars[["mpg"]]),label="TEST"))

The font of "TEST" comes out all fuzzy (tried X11 and postscript
devices).

How might that be fixable?

Thanks, Joh

baptiste auguie

unread,
Jun 25, 2010, 8:47:21 AM6/25/10
to Johannes Graumann, ggplot2
Hi,

Your geom_text layer is using the default data.set, therefore it
superimposes many times the same label.

Try this instead,

library(ggplot2)
p <- ggplot(mtcars, aes(factor(cyl), mpg))
p + geom_boxplot() +

geom_text(data=data.frame(x=1,y=min(mtcars[["mpg"]])),aes(x=x,y=y,label="TEST"))

## or more concisely

library(ggplot2)
p <- ggplot(mtcars, aes(factor(cyl), mpg))

p + geom_boxplot() + annotate("text",x=1,y=min(mtcars[["mpg"]]),label="TEST")

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
>

Johannes Graumann

unread,
Jul 8, 2010, 9:46:20 AM7/8/10
to baptiste auguie, Johannes Graumann, ggplot2
(Late) Thanks for your hints! Kept struggeling with it until I figured out that
when starting q plot with "qplot" even your advice fails and one has to return
to a "ggplot"-based assembly.

Thanks, Joh

signature.asc
Reply all
Reply to author
Forward
0 new messages