Hey, I'm new with R and I'm attempting to map and then plot points on a
map
of Antarctica with help from some code at the following link. Link
<http://www.molecularecologist.com/2012/09/making-maps-with-r/>
After downloading the packages here is the code I used. I feel like the
problem has to do with the coordinates since I get a very small image that
appears to be only a small portion of the continent (I want the whole
thing). Thanks in advance!
library(maps)
library(mapdata)
map("worldHires","Antarctica",xlim=c(-90,-60),ylim=c(-180,180),col="gray90",fill=TRUE)
--
View this message in context:
http://r.789695.n4.nabble.com/Map-Antarctica-tp4668713.html
Sent from the R help mailing list archive at Nabble.com.
You have mixed your x with your y, try this:
map("worldHires","Antarctica",ylim=c(-90,-60),xlim=c(-180,180),col="gray90",fill=TRUE)
I tend not to use maps/mapdata if I can help it (there are problems as
you can see, though there is support for projections with mapproject,
see ?map), if you want to use an alternative try this.
library(maptools)
data(wrld_simpl)
## select out just the continent
antarctica <- wrld_simpl[wrld_simpl$NAME == "Antarctica", ]
plot(antarctica)
degAxis(1)
degAxis(2)
For a better display of this part of the world
library(rgdal)
## define a sensible projection
pr <- "+proj=laea +lat_0=-90 +ellps=WGS84 +datum=WGS84 +no_defs
+towgs84=0,0,0"
antarctica.laea <- spTransform(antarctica, CRS(pr))
plot(antarctica.laea)
Removing the dud coordinates at -90 is a bit more difficult, but can
be done (the first plot by map() has a similar problem).
There is a mailing list R-Sig-Geo which is more topical for questions
like this if you want to explore further.
Cheers, Mike.
On Wed, Jun 5, 2013 at 11:00 PM, ejb <ejb274 at psu.edu>
wrote:> Hey, I'm new with R and I'm attempting to map and then plot points
on a map
> of Antarctica with help from some code at the following link. Link
> <http://www.molecularecologist.com/2012/09/making-maps-with-r/>
>
> After downloading the packages here is the code I used. I feel like the
> problem has to do with the coordinates since I get a very small image that
> appears to be only a small portion of the continent (I want the whole
> thing). Thanks in advance!
>
> library(maps)
> library(mapdata)
>
map("worldHires","Antarctica",xlim=c(-90,-60),ylim=c(-180,180),col="gray90",fill=TRUE)
>
>
>
>
>
>
>
> --
> View this message in context:
http://r.789695.n4.nabble.com/Map-Antarctica-tp4668713.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> 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.
--
Michael Sumner
Hobart, Australia
e-mail: mdsumner at gmail.com
Hi,
There is a problem with xlim and ylim.
map("worldHires","Antarctica",xlim=c(-180,180),ylim=c(-90,-60),col="gray90",fill=TRUE)
You also might have a look at "ggplot2"
library(ggplot2)
world <- map_data("world")
worldmap <- ggplot(world, aes(x=long, y=lat, group=group)) +
geom_path() +
scale_y_continuous(breaks=(-2:2) * 30) +
scale_x_continuous(breaks=(-4:4) * 45)
worldmap + coord_map("ortho", orientation=c(-90, 0, 0))
Regards,
Pascal
On 05/06/13 22:00, ejb wrote:> Hey, I'm new with R and I'm attempting to map and then plot points
on a map
> of Antarctica with help from some code at the following link. Link
> <http://www.molecularecologist.com/2012/09/making-maps-with-r/>
>
> After downloading the packages here is the code I used. I feel like the
> problem has to do with the coordinates since I get a very small image that
> appears to be only a small portion of the continent (I want the whole
> thing). Thanks in advance!
>
> library(maps)
> library(mapdata)
>
map("worldHires","Antarctica",xlim=c(-90,-60),ylim=c(-180,180),col="gray90",fill=TRUE)
>
>
>
>
>
>
>
> --
> View this message in context:
http://r.789695.n4.nabble.com/Map-Antarctica-tp4668713.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> 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.
>