I'm facing a minor aesthetic challenge in the attached graph.
load("d.rda")
dl <- subset(d2, a0 == "3" & ar %in% c(1, 1.6, 2.2))
p <-
ggplot(data = subset(d2, ar < 2.4), mapping = aes(x = value, y = int))+
stat_smooth( method = "lm", colour="grey") +
scale_shape("polarisation\naxis",labels=c("long", "short"), solid=F)+
geom_point(mapping=aes(shape=factor(variable), colour=a0))+
geom_text(data=dl,hjust=1.5, vjust=0, size=2,
mapping=aes(label=factor(ar), colour=a0))+
scale_x_continuous(breaks=10^-seq(8, 4, by=-1), trans="log10",
expression(paste(V/L, " (", mu*m^3, ")"))) +
scale_y_continuous(breaks=10^-seq(7, 3, by=-1),trans="log10",
expression(integral(sigma[ext]*(lambda)*d*lambda,0, infinity )* "
("*mu*m^3*")")) +
scale_colour_brewer("equ. radius\n / nm", palette="Set1")+theme_bw()
p
I'd like to specify symbol shapes that vary as "ar", but for each
shape there would be a hollow symbol for variable =="long" and a full
symbol for variable == "short". Hope this makes sense...
Best wishes,
baptiste
--
_____________________________
Baptiste Auguié
School of Physics
University of Exeter
Stocker Road,
Exeter, Devon,
EX4 4QL, UK
Phone: +44 1392 264187
http://newton.ex.ac.uk/research/emag
______________________________
That's been sitting on my to do list for a long time, but I've never
needed it so I haven't made any progress on it. The drawing part
should be pretty easy - as always, it's the legends that are really
hard. If you want to have a go at writing your own geom, I'd
recommend looking at the source for geom_point. There's only one
method you really need to implement - draw().
Hadley
Like this?
ggplot(d,aes(x=x,y=y,shape=z1, fill=z2)) +
geom_point() +
scale_shape_manual(values = 22:25)
The default legend isn't very good though. You can hack around it with:
GeomPoint$default_aes <- function(.) aes(shape=22, colour="black",
size=2, fill = NA, alpha = 1)
ggplot(d,aes(x=x,y=y,shape=z1, fill=z2)) +
geom_point() +
scale_shape_manual(values = 22:25)
Hadley
many thanks,
baptiste
PS: i'd like to have a go at the custom grob idea, but since i'm
currently finishing up my thesis it'll probably have to wait for me as
well.
--