I indeed also tried using set_default_shape(), but was unlucky...
It works for me.
set_default_scale("shape","manual", "shape",value=c(1,16))
qplot(x,y,data=data.frame(x=1,y=1,s="a"),shape=s)
You don't need the extra + scale_shape_manual(). If I've missed
something, please create a reproducible example that makes it really
really really obvious what the problem is.
Hadley
I guess the problem is that,
set_default_scale("shape","manual", "shape",value=c(2))
qplot(x,y,data=data.frame(x=1,y=1,s="a"),shape=s)
produces the same output (on my machine anyway) as,
set_default_scale("shape","manual", "shape",value=c(1))
qplot(x,y,data=data.frame(x=1,y=1,s="a"), shape=s)
(both produce a black disc = 16 in the center, where one'd expect an
open triangle for the first case and an open circle for the second)
i.e., the default shapes used by the scale aren't affected. Or did I
miss the intended effect of
set_default_scale ?
When i played with this last time, I was hoping to do something along
those lines,
d = data.frame(x=1:10,y=1:10,s=rep(letters[1:3],length=10))
qplot(x,y,data=d,shape=s)
ScaleShape$output_set <- function (.)
{
c(1, 16, 17, 15, 3, 7, 8)[1:length(.$input_set())]
}
qplot(x,y,data=d,shape=s)
However this is rather destructive (the only way to revert back seems
to be a restart of R?!). I haven't been able to make a copy of the
scale that doesn't affect the ggplot2 version (probably something to
do with the proto system).
sessionInfo()
R version 2.9.0 (2009-04-17)
i386-apple-darwin9.6.0
locale:
en_GB.UTF-8/en_GB.UTF-8/C/C/en_GB.UTF-8/en_GB.UTF-8
attached base packages:
[1] grid stats graphics grDevices utils datasets methods
[8] base
other attached packages:
[1] ggplot2_0.8.2 reshape_0.8.2 plyr_0.1.5 proto_0.3-8
Does this make sense?
baptiste
> Hadley
>
>
> --
> http://had.co.nz/
Ok, there are two problems:
* firstly you want to be setting the default scale for discrete
shapes - not "manual" shapes
* however, set_default_scale("shape","discrete", "manual",value=c(1))
doesn't work for reasons I can't immediately remember.
I'll look into it.
Hadley