Re: [R] another question on shapefiles and geom_point in ggplot2

From: Manuel Spínola <mspinola10_at_gmail.com>
Date: Mon, 04 Apr 2011 05:55:41 -0600

Thank you Ahmadou,

I got an error when I change fill to colour:

 > p + geom_point(aes(size = ACE, colour = ACE)) + theme_bw() + + scale_size(to = c(3, 15), name = "Número de especies", breaks = c(10, 40, 70, 100, 130, 160, 190, 220, 250)) + + scale_colour_gradientn(name = 'Número de especies', colours = heat.colors(9), breaks = c(10, 40, 70, 100, 130, 160, 190, 220, 250)) + xlab("Longitud") + ylab("Latitud") +
+ opts(axis.text.x = theme_text(size = 8, vjust = 1)) + opts(axis.text.y = theme_text(size = 8, hjust = 1)) + + geom_path(aes(x=long,y=lat,group=group, colour=id),data=fortify.ai_biotica)
Error: Non-continuous variable supplied to scale_colour_gradientn.

Best,

Manuel

On 04/04/2011 03:37 a.m., ahmadou dicko wrote:
> Hi all
> Just as Pierre pointed out, i used rgeos instead of gpclib (the
> licence is less restrictive even though i'm still students). A since
> the last release the rgeos package seems to work well.
> I'm really disapointed by the fact that some packages (e.g
> adehabitatMA which is great thank's M. Calenge) still use gpclib and
> don't offer the possibility to switch to rgeos, and is really messy
> to have two package to do the same task and with the same function
> name in the path (eg when i use adehabitatMA and maptools).
>
> Manuel:
> May be you should use the *colour* aesthetic instead of**the*fill
> *one**in the call of *geom_path*. Something like that :
>
> p = ggplot(geo, aes(x, y))
> p + geom_point(aes(size = ACE, colour = ACE)) + theme_bw() +
> scale_size(name = "Número de especies", breaks = c(2, 4, 6, 8, 10, 12,
> 14, 16, 18, 20)) + scale_colour_gradientn(name = 'Número de especies',
> colours = heat.colors(10), breaks = c(2, 4, 6, 8, 10, 12, 14, 16, 18,
> 20))+ xlab("Longitud") + ylab("Latitud") + opts(axis.text.x =
> theme_text(size = 8, vjust = 1)) + opts(axis.text.y = theme_text(size
> = 8, hjust = 1)) + geom_path(aes(x=long,y=lat, group=group,
> *colour=id*),data=fortify.ai_biotica)
>
> not tested, so i'm not really sure about this one
>
> 2011/4/4 Pierre Roudier <pierre.roudier_at_gmail.com
> <mailto:pierre.roudier_at_gmail.com>>
>
> Hi all,
>
> 2011/4/4 Felipe Carrillo <mazatlanmexico_at_yahoo.com
> <mailto:mazatlanmexico_at_yahoo.com>>:
> > Manuel:
> > As far as I know one needs gpclibPermit() in order to fortify
> > see this:
> > Note: polygon geometry computations in maptools
> > depend on the package gpclib, which has a
> > restricted licence. It is disabled by default;
> > to enable gpclib, type gpclibPermit()
> > I am going to guess that ahmadou dicko doesn't show
> gpclibPermit() on his
> > code
> > because he loaded it with Rprofile or some other way. I tried to
> run his
> > code without
> > gpclibPermit() and it wouldn't let me fortify, so not sure how
> he did it.
>
> On that specific point, Colin Arundel and Roger Bivant released the
> rgeos package on CRAN a few days [1]. This is a great achievement as
> it brings bindings to the GEOS C++ lib [2] - long story short, it
> makes the job the non-free [3] gpclib used to do.
>
> In its later release, maptools has an option to check if rgeos if
> present - if it is the case it is used instead of gpclib:
>
> > library(maptools)
> Loading required package: foreign
> Loading required package: sp
> Loading required package: lattice
>
> Note: polygon geometry computations in maptools
> depend on the package gpclib, which has a
> restricted licence. It is disabled by default;
> to enable gpclib, type gpclibPermit()
>
> Checking rgeos availability as gpclib substitute:
> TRUE
> > ?gpclibPermit
>
> Pierre
>
> [1] http://cran.r-project.org/web/packages/rgeos/
> [2] http://trac.osgeo.org/geos/
> [3] https://stat.ethz.ch/pipermail/r-sig-geo/2010-January/007400.html
> --
> Scientist
> Landcare Research, New Zealand
>
> --
> 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 ggplot2_at_googlegroups.com
> <mailto:ggplot2_at_googlegroups.com>
> To unsubscribe: email ggplot2+unsubscribe_at_googlegroups.com
> <mailto:ggplot2%2Bunsubscribe_at_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
mspinola_at_una.ac.cr
mspinola10_at_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/>

	[[alternative HTML version deleted]]



______________________________________________ R-help_at_r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

Received on Mon 04 Apr 2011 - 12:16:27 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 04 Apr 2011 - 12:20:28 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive