On Tue, 7 Apr 2009, Patrizio Frederic wrote:
Roger,
many thanks for your very useful suggestions.
I've just produced some plot using xlim/ylim. I noticed I can only
zoom in a square box. Is there any way to produce rectangular ones?
What happens is that you are seeing the default square dimensions of the
graphics device, which with an aspect ratio suiting maps, makes it "look"
square. Change the dimensions of the graphics device (for example when you
initiate it) to be proportional to the xlim/ylim ratio, and you should be
able to get what you want. Paul Murrell's R Graphics book is a great help
for getting graphics to do what you want, but looking at ?x11 or ?windows,
or ?postscript or ?pdf for file output, will cover the basics.
Hope this helps,
Roger
Best
Patrizio
2009/4/7 Roger Bivand <roger.biv...@nhh.no>:
Patrizio Frederic <frederic.patrizio <at> gmail.com> writes:
dear all,
I'm a newbie in map tools. I was asking to perform an apparently very
simple task.
I have a list of countries (about fifty all over in the world) scored
with a real positive value. Eg
...
I wish to plot geographical maps where every country is filled with a
color depending on his score.
Using maptools library and wrld_simpl I can easily perform the world
map.
Note that the file is included in recent releases of maptools, so just say
data(wrld_simpl)
library(maptools)
load(url("http://spatial.nhh.no/R/etc/TM_WORLD_BORDERS_SIMPL-0.2.RData"))
For matching the countries you have with the countries in the object (note
that names may differ), I suggest simply adding ISO3 codes to your data
frame, and using them as row names as well. Look at the spCbind methods in
maptools.
Now what if I wish to zoom on some sub world regions such as Eastern
Europe or America or any other user defined contiguous sub group?
Either select using [ or plot using xlim/ylim arguments
Russia is a large country I could be interested in cutting it in two
peaces eastern and western. Can I do it using wrld_simpl or should I
search for other data? If so where can I find free maps data?
You can plot part of Russia with the object as it is by using xlim/ylim
arguments. You can manipulate low-level objects if you need to, but
it is not easy unless you know what you are doing.
Some documentation exists but it seems sparse to me.
The R-sig-geo list is more focussed on this kind of question, as is pointed
out on the Spatial Task View on CRAN.
Hope this helps,
Roger Bivand
Any hints will be appreciated.
Thanks in advance,
Patrizio
______________________________________________
R-help@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.
--
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: roger.biv...@nhh.no
______________________________________________
R-help@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.