Dear R-SIG-GEO listers,
I'm having difficulties to solve what is probably an easy problem.
I'm preparing some maps using the function 'gmap' from the package 'dismo'.
I am able to produce the kind of map that I'm interested in but now I would
like to plot multiple maps in a single figure. I tried using
par(mfrow=c()), par(fig=c()), layout, and split.screen, but none of them
worked. Is there any function that allows me to plot several gmaps in a
single figure?
Below there is some code that explains better what I'm trying to do.
Thanks a lot for your time and any help,
Ahimsa
# =================================
# installing required library
install.packages("dismo")
library(dismo)
# first I will use a scatterplot to illustrate what I want to do
# generating and plotting some random numbers:
x <- runif(10, 1, 10)
y <- runif(10, 1, 10)
plot(x,y) # as a single plot
# to plot four graphs in a single figure:
par(mfrow=c(2,2))
plot(x,y)
plot(x,y)
plot(x,y)
plot(x,y)
# alternatively, I could want to customize the size of each graph:
par(fig=c(0,0.5,0.5,1))
plot(x,y)
par(fig=c(0.5,1,0.5,1), new=T)
plot(x,y)
par(fig=c(0,1,0,0.5), new=T)
plot(x,y)
# Now I'm going to use dismo's gmap
# first I create a plot
g <- gmap("Lombock")
plot(g) # this produces a nive plot of the Indonesian island of Lombock
# if I try to split the graphic device to show for maps:
par(mfrow=c(2,2))
plot(g)
plot(g)
plot(g)
plot(g)
# it doesn't work
# or:
par(fig=c(0,0.5,0.5,1))
plot(g)
par(fig=c(0.5,1,0.5,1), new=T)
plot(g)
par(fig=c(0,1,0,0.5), new=T)
plot(g)
# again, it doesn't work
# I have also tried with layout and split.screen, but they did not work
# any suggestion?
# =================================
PS - I'm using R 2.15.2 in Mac with OSX 10.8.4
--
Ahimsa Campos-Arceiz
Associate Professor
School of Geography
The University of Nottingham Malaysia Campus
www.meme-elephants.org
http://www.facebook.com/MEME.project
*Je n'ai fait celle-ci plus longue que parce que je n'ai pas eu le loisir
de la faire plus courte.
Blaise Pascal, 1656*
[[alternative HTML version deleted]]
_______________________________________________
R-sig-Geo mailing list
[email protected]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo