Legend diagonal lines

93 views
Skip to first unread message

Felipe

unread,
Sep 22, 2010, 4:37:40 PM9/22/10
to ggplot2
Hi:
Does anybody know if there is a workaround about the legend diagonal
lines or points?
I found this old thread and thought it could be something inside opts
to take care of this and make it optional

http://tolstoy.newcastle.edu.au/R/e5/help/08/12/10578.html

Luciano Selzer

unread,
Sep 22, 2010, 5:05:32 PM9/22/10
to Felipe, ggplot2
Hi Felipe, I think you just add legend = FALSE to the geom call.

HTH
Luciano


2010/9/22 Felipe <mazatla...@yahoo.com>

--
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

Felipe

unread,
Sep 23, 2010, 9:14:12 PM9/23/10
to ggplot2
Thanks Luciano but I did try that before I posted. My legend colors
turn white after I
use legend=TRUE but nothing happens to the labels. I'll try a couple
more things.

On Sep 22, 2:05 pm, Luciano Selzer <luciano.sel...@gmail.com> wrote:
> Hi Felipe, I think you just add legend = FALSE to the geom call.
>
> HTH
> Luciano
>
> 2010/9/22 Felipe <mazatlanmex...@yahoo.com>
>
>
>
> > Hi:
> > Does anybody know if there is a workaround about the legend diagonal
> > lines or points?
> > I found this old thread and thought it could be something inside opts
> > to take care of this and make it optional
>
> >http://tolstoy.newcastle.edu.au/R/e5/help/08/12/10578.html
>
> > --
> > 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<ggplot2%2Bunsu...@googlegroups.com­>
> > More options:http://groups.google.com/group/ggplot2- Hide quoted text -
>
> - Show quoted text -

Luciano Selzer

unread,
Sep 23, 2010, 10:39:02 PM9/23/10
to Felipe, ggplot2
Felipe, the code in the other post you sent describes your issue. I don't know how to do it but I have an ugly workaround. I added geom_polygon without color="blue", which will make a nice legend, and plot on top of it the geom with blue borders.


utah_basins <- ggplot(shp2,aes(long,lat,group=group,fill=level3_nam)) +
 geom_polygon() + geom_polygon(colour="blue", legend = F)
 utah_basins

HTH

Luciano


2010/9/23 Felipe <mazatla...@yahoo.com>

Felipe Carrillo

unread,
Sep 23, 2010, 11:23:25 PM9/23/10
to Luciano Selzer, ggplot2
Thanks Luciano:
I've done things like that where I had to call geom_point() or geom_line to make work but
I didn't even think about doing this with geom_polygon(). Is a great workaround but I don't understand
why it wouldn't work with just one geom. Thanks again and the shapefile was the example I was
talking about. Now I am trying to figure out why one of my shapes with the same name is not being filled.
 
Felipe D. Carrillo
Supervisory Fishery Biologist
Department of the Interior
US Fish & Wildlife Service
California, USA

Luciano Selzer

unread,
Sep 24, 2010, 8:34:39 AM9/24/10
to Felipe Carrillo, ggplot2
This is Hadley's design choice. He wants the legend to be match exactly the geom. Maybe, this can be confusing as the blue outlines does not change over the levels. Hadley, would be too hard to have an option to turn this behaviour off?

Regards

Luciano


2010/9/24 Felipe Carrillo <mazatla...@yahoo.com>
Reply all
Reply to author
Forward
0 new messages