I see how I can set the family of individual text elements to
theme_text(family="serif"), and I can hack the following to get all
text in a plot set in a serif font:
> text_elements <- grep("title|text",names(theme_get()),value=TRUE)
> theme_orig <- theme_get()[text_elements]
> theme_new <- lapply(theme_orig,function(x) theme_text(family="serif"))
> do.call(theme_update,theme_new)
is there a simpler/easier/more elegant way to do this?
Ben Bolker
here is a bad hack
library(ggplot2)
d <- data.frame(x=runif(10),y=runif(10))
g1 <- ggplot(d,aes(x=x,y=y))+geom_point();
print(g1)
grid.gedit("text",gp=gpar(fontfamily="serif"))
> --
> 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
>
Not that I know of.
Hadley
--
Assistant Professor / Dobelman Family Junior Chair
Department of Statistics / Rice University
http://had.co.nz/
library(ggplot2)
d <- data.frame(x=runif(10),y=runif(10))
g1 <- ggplot(d,aes(x=x,y=y))+geom_point() + ylab("This is the Y-Axis
Label") + xlab("This is the X-Axis Label")
g1 + theme_grey()
formals(theme_text)$family <- "serif"
assignInNamespace("theme_text", theme_text, "ggplot2")
dev.new()
g1 + theme_grey()
Best,
Ista
> --
> 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
>
--
Ista Zahn
Graduate student
University of Rochester
Department of Clinical and Social Psychology
http://yourpsyche.org