[R] Retrieve Axis coordinates from map

Peter Alspach Peter.Alspach at plantandfood.co.nz
Fri Jul 25 03:15:04 CEST 2014

Tena koe Julien

I don't use the maps package much, but I suspect par()$usr will allow you to do what you want.

HTH ....

Peter Alspach

-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of Julien Million
Sent: Friday, 25 July 2014 9:05 a.m.
To: r-help at r-project.org
Subject: [R] Retrieve Axis coordinates from map


i want to automatise the creation of some maps with R, however, I would need to be able to retrieve the coordinates of the axes that R is automatically generated. 

When using the package MAPS, and creating a map, R will automatically adjust the plot to the region that you are plotting.

for example the two command:
will generate plots with completely different axis and scale. If I want to automatically generate a map and add a legend to it, I would need to be able to retrieve the coordinates of my axis that were automatically generated in order to give coordinate to place my legend on the map.

Basically I would like to automatise the following with a function, and be able to automatically get the coordinates for my legend)

legend(-12,34, "blablabla")

legend(-150,40, "blablabla")

mapcountry <- function(country) {
legend(xxxx, yyyy, "blablabla")

I want to be able to extract the xxxx and yyyy automatically to be able to generate the legend within the function.



	[[alternative HTML version deleted]]

R-help at r-project.org mailing list
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
The contents of this e-mail are confidential and may be ...{{dropped:14}}

More information about the R-help mailing list