--
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
p = ggplot(geo, aes(x, y, size = md, colour = md))
p + geom_point() + theme_bw() + facet_wrap(~sitio, scales="free") +
scale_size(name = "Indice", breaks = c(0.1, 0.5, 1, 5, 10, 15, 20, 25,
50)) + scale_colour_gradient(name = "Indice", low = "#000000", high =
"#D3D3D3", breaks = c(0.1, 0.5, 1, 5, 10, 15, 20, 25, 50))+
xlab("Longitud") + ylab("Latitud") + opts(axis.text.x =
theme_text(size = 8, vjust = 1)) + opts(axis.text.y = theme_text(size
= 8, hjust = 1))
-Ista
--
Ista Zahn
Graduate student
University of Rochester
Department of Clinical and Social Psychology
http://yourpsyche.org
The issue here is that scale_grey works on a sequential (discrete)
scale as opposed to a continuous one. So when it gets a continuous
variable, it errors just like scale_shape would. (Which turns out to
be a bad example because, in a bizarre turn of events, scale_shape
works with continuous variables. Try running qplot(1:10, 1:10, shape
= rnorm(10)) .) I always thought that the grey scale was a kind of
simplified wrapper for scale_gradient(low = 'black', high = 'white');
is there a reason why it forces a discrete scale?
My feeling after this little investigation - http://www.youtube.com/watch?v=4DVAsmrwdtQ
Cheers
david.
On Oct 19 2010, 7:48 am, Manuel Spínola <mspinol...@gmail.com> wrote:
> Ista and Brandon, thank you very much.
> The continuous color scale work.
>
> Best,
>
> Manuel
>
> On 19/10/2010 06:58 a.m., Ista Zahn wrote:
>
>
>
>
>
> > Another option would be to use a continuous color scale, and set the
> > high and low values to different shades of grey, like this
>
> > p = ggplot(geo, aes(x, y, size = md, colour = md))
> > p + geom_point() + theme_bw() + facet_wrap(~sitio, scales="free") +
> > scale_size(name = "Indice", breaks = c(0.1, 0.5, 1, 5, 10, 15, 20, 25,
> > 50)) + scale_colour_gradient(name = "Indice", low = "#000000", high =
> > "#D3D3D3", breaks = c(0.1, 0.5, 1, 5, 10, 15, 20, 25, 50))+
> > xlab("Longitud") + ylab("Latitud") + opts(axis.text.x =
> > theme_text(size = 8, vjust = 1)) + opts(axis.text.y = theme_text(size
> > = 8, hjust = 1))
>
> > -Ista
>
> > On Tue, Oct 19, 2010 at 8:44 AM, Brandon Hurr<bhiv...@gmail.com> wrote:
> >> It looks like the scale_grey is working but something has been thrown out of
> >> whack with the scale_size(). I'm guessing that you have more than the levels
> >> that you've indicated in your data. It's really hard to play with the code
> >> without a reproducible example or your real data though.
> >> Do you have the same levels of MP as you have indicated in your scales?
> >> levels(factor(geo$mp))
> >> #should look like this list
> >> c(0.1, 0.5, 1, 5, 10, 15, 20, 25, 50))
> >> Brandon
>
> >> On Tue, Oct 19, 2010 at 13:21, Manuel Sp�nola<mspinol...@gmail.com> wrote:
> >>> Thank you very much Brandon.
>
> >>> It doesn't give me an error but it doesn't plot what I want. It gives me
> >>> a strange result. The plot is attached.
>
> >>> Best,
>
> >>> Manuel
>
> >>> On 19/10/2010 06:14 a.m., Brandon Hurr wrote:
>
> >>> Manuel,
> >>> If you specify md as a factor does it give you an error?
> >>> p = ggplot(geo, aes(x, y, size = factor(md), colour = factor(md)))
> >>> p + geom_point() + theme_bw() + facet_wrap(~sitio, scales="free") +
> >>> scale_size(name = "Indice", breaks = c(0.1, 0.5, 1, 5, 10, 15, 20, 25, 50))
> >>> + scale_colour_grey(name = "Indice", start = 0.1, end = 0.9, breaks = c(0.1,
> >>> 0.5, 1, 5, 10, 15, 20, 25, 50))+ xlab("Longitud") + ylab("Latitud") +
> >>> opts(axis.text.x = theme_text(size = 8, vjust = 1)) + opts(axis.text.y =
> >>> theme_text(size = 8, hjust = 1))
> >>> Saludos,
> >>> Brandon
>
> >>> On Tue, Oct 19, 2010 at 13:04, Manuel Sp�nola<mspinol...@gmail.com>
> >>> wrote:
> >>>> Dear list members,
>
> >>>> I am trying to use scale_colour_grey, but igot an error:
>
> >>>>> p = ggplot(geo, aes(x, y, size = md, colour = md))
> >>>>> p + geom_point() + theme_bw() + facet_wrap(~sitio, scales="free") +
> >>>>> scale_size(name = "Indice", breaks = c(0.1, 0.5, 1, 5, 10, 15, 20, 25, 50))
> >>>>> + scale_colour_grey(name = "Indice", start = 0.1, end = 0.9, breaks = c(0.1,
> >>>>> 0.5, 1, 5, 10, 15, 20, 25, 50))+ xlab("Longitud") + ylab("Latitud") +
> >>>>> opts(axis.text.x = theme_text(size = 8, vjust = 1)) + opts(axis.text.y =
> >>>>> theme_text(size = 8, hjust = 1))
> >>>> Error: Continuous variable (Indice) supplied to discrete scale_grey.
>
> >>>> Does anybody know why?
> >>>> Best,
>
> >>>> Manuel
>
> >>>> --
> >>>> Manuel Sp�nola, Ph.D.
> >>>> Instituto Internacional en Conservaci�n y Manejo de Vida Silvestre
> >>>> Universidad Nacional
> >>>> Apartado 1350-3000
> >>>> Heredia
> >>>> COSTA RICA
> >>>> mspin...@una.ac.cr
> >>>> mspinol...@gmail.com
> >>>> Tel�fono: (506) 2277-3598
> >>>> Fax: (506) 2237-7036
> >>>> Personal website: Lobito de r�o
> >>>> Institutional website: ICOMVIS
> >>>> --
> >>>> 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
>
> >>> --
> >>> Manuel Sp�nola, Ph.D.
> >>> Instituto Internacional en Conservaci�n y Manejo de Vida Silvestre
> >>> Universidad Nacional
> >>> Apartado 1350-3000
> >>> Heredia
> >>> COSTA RICA
> >>> mspin...@una.ac.cr
> >>> mspinol...@gmail.com
> >>> Tel�fono: (506) 2277-3598
> >>> Fax: (506) 2237-7036
> >>> Personal website: Lobito de r�o
> >>> Institutional website: ICOMVIS
> >> --
> >> 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
>
> --
> *Manuel Sp�nola, Ph.D.*
> Instituto Internacional en Conservaci�n y Manejo de Vida Silvestre
> Universidad Nacional
> Apartado 1350-3000
> Heredia
> COSTA RICA
> mspin...@una.ac.cr
> mspinol...@gmail.com
> Tel�fono: (506) 2277-3598
> Fax: (506) 2237-7036
> Personal website: Lobito de r�o
> <https://sites.google.com/site/lobitoderio/>
> Institutional website: ICOMVIS <http://www.icomvis.una.ac.cr/>
Yes, this is a long-standing bug that I need to fix :(
> I always thought that the grey scale was a kind of
> simplified wrapper for scale_gradient(low = 'black', high = 'white');
> is there a reason why it forces a discrete scale?
Because it's not a short cut for scale_gradient - it's a more like a
specialised version of gradient for discrete variables (when they are
actually ordered)
Hadley
--
Assistant Professor / Dobelman Family Junior Chair
Department of Statistics / Rice University
http://had.co.nz/