Hi,
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:
map(regions="Morocco")
or
map(regions="France")
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)
map(regions="Morocco")
map.axes()
legend(-12,34, "blablabla")
map(regions="France")
map.axes()
legend(-150,40, "blablabla")
mapcountry <- function(country) {
map(regions=country)
map.axes()
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.
Thanks
Julien
[[alternative HTML version deleted]]