# Rogers suggestion was
library(RColorBrewer)
bl5 <- brewer.pal(5, "Blues")
mypal <- colorRampPalette(bl5)
# but he was saying any method of getting a list of colours is OK
rev(mypal(256))
rainbow(256)
colorRampPalette(c("lightblue","navy"))(256)
# then your example
library(spatstat)
data(longleaf)
Z <- smooth.ppp(longleaf)
par(mfrow = c(2,2))
plot(Z)
plot(Z, col=rev(mypal(256)))
plot(Z, col = colorRampPalette(c("lightblue","navy"))(256))
plot(Z, col = rainbow(256))
When Roger noted they were hard-coded he meant that the function
topo.colors and others are standard. Adrian was just pointing out that
his function is not hard coded to those functions and that you can use
any other function.
Tom
-----Original Message-----
From: r-sig-geo-bounces at stat.math.ethz.ch
[mailto:r-sig-geo-bounces at stat.math.ethz.ch] On Behalf Of Graham Smith
Sent: Wednesday, 30 April 2008 3:00 AM
To: r-sig-geo at stat.math.ethz.ch
Subject: Re: [R-sig-Geo] Changing colour gradient in Spatstat surface
plot
Adrian
Thanks for the reply
Here is an example of the whole process, starting from a marked point
pattern and finishing with a colour image:
library(spatstat)
data(longleaf)
Z <- smooth.ppp(longleaf)
plot(Z)
plot(Z, col=topo.colors(256))
This is what I did, but I couldn't find, and still can't find,
anything in the help for plot.im or topo,colors that explains how to
change the colours to graduated blue, am being really dim here.
However, in another post it was suggested I use rColorbrewer to set up
the colours , but it worries me that I cannot find the bit in the help
you have sent me to.
Graham
_______________________________________________
R-sig-Geo mailing list
R-sig-Geo at stat.math.ethz.ch
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Dear List,
I would be thankful if anybody give me an way-out that How should can i
add scale bar in the RGB color image. Actually i want to use this image
for other purpose where i should mention the scale of the image.
I think that a few more details might help. This example uses methods from
the sp package. Setup:
library(sp)
data(meuse.grid)
coordinates(meuse.grid) <- c("x", "y")
gridded(meuse.grid) <- TRUE
With lattice graphics:
l1 <- list("SpatialPolygonsRescale", layout.scale.bar(),
offset = c(180500,329800), scale = 500, fill=c("transparent","black"))
l2 = list("sp.text", c(180500,329900), "0")
l3 = list("sp.text", c(181000,329900), "500 m")
spplot(meuse.grid, "dist", col.regions=grey.colors(20),
sp.layout=list(l1, l2, l3))
With base graphics:
image(meuse.grid, "dist", col=grey.colors(20))
SpatialPolygonsRescale(layout.scale.bar(), offset = c(180500, 329800),
scale = 500, fill=c("transparent","black"), plot.grid=FALSE)
text(180500, 329900, "0")
text(181000, 329900, "500 m")
layout.scale.bar() can take an argument setting the height of the scale
bar, relative to the initial length of unity.
If this doesn't help, could you give an example of your problem using this
or another accessible data set?
Roger
Thanking you in advance
Pujan
_________________________________________________________________
Make i'm yours.? Create a custom banner to support your cause.
MSN_Make_IM_Yours
[[alternative HTML version deleted]]
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.Bivand at nhh.no