alpha beta gamma
1.00| | |
| | |
0.75| .... | .. |
| . . | .. | ..
0.50| .. | .. | ... ..
| . . | .... |.... .....
0.25| . . | .. |.
|. .. |... |.
0.00\--------------- \--------------- \---------------
0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7
I would like to have this
1.00| | |
| | |
0.75| .... | .. |
| . . | .. | ..
0.50| .. | .. | ... ..
| . . | .... |.... .....
0.25| . . | .. |.
|. .. |... |.
0.00\--------------- \--------------- \---------------
0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7
alpha beta gamma
Is there any way to do that? Something with opts() maybe?
Thanks,
zw
library(ggplot2)
library(gridExtra)
p <- ggplot(diamonds, aes(carat, ..density..)) +
geom_histogram(binwidth = 0.2) + facet_grid(. ~ cut) +
labs(x=NULL)
g <- ggplotGrob(p)
gg <- getGrob(g,"axis.title.y.text",grep=TRUE)
ytitle <- if(is.zero(gg) || is.null(gg)) ggplot2:::.zeroGrob else
editGrob(gg, vp=NULL)
gg <- getGrob(g,"axis.text.y.text",grep=TRUE)
ylabel <- if(is.zero(gg) || is.null(gg)) ggplot2:::.zeroGrob else
editGrob(gg, vp=NULL)
category <- levels(diamonds$cut)
labs <- llply(category, textGrob, just=c("centre","bottom"),
gp=gpar(fontsize=10))
my.labels <- do.call(arrangeGrob,
c(labs, list(nrow=1, sub="My x title",
left=rectGrob(width=
grobWidth(ylabel), gp=gpar(col=NA),
x=unit(1, "lines"), just="right"))))
## grid.draw(my.labels)
xlab <- gTree(children=gList(my.labels), cl="mylabels" ,
vp=viewport(width=unit(0.3, "npc")))
heightDetails.mylabels <- function(x)
do.call(max, llply(labs, grobHeight)) + unit(1, "line")
foo <- function()
function(label, x, y)
xlab
p + opts(strip.text.y =theme_blank(),
strip.background=theme_blank()) +
opts( axis.title.x = foo()) +
opts(strip.background = theme_blank(),
strip.text.x = theme_blank())
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
>
> --
> 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
>
--
Assistant Professor / Dobelman Family Junior Chair
Department of Statistics / Rice University
http://had.co.nz/
Incidentally, where is the option to set the overall plot title
hiding? Or is there even such a thing? It's mentioned in the theme
settings list but I can't find it anywhere else.
zw