[R-sig-Geo] Changing colour gradient in Spatstat surface plot

adrian at maths.uwa.edu.au adrian at maths.uwa.edu.au
Tue Apr 29 10:27:59 CEST 2008


Graham Smith <graham.smith at myotis.co.uk> writes:

> I have produced a smoothed surface plot of
> water depths (depths as marks) in spatstat, but the default colours
> are oranges and reds. How do I change these to blues.

> Can I redifne the colours in terrain.colors() or topo.colors(), or do
> I need to use rainbow(). Or is its something different all together.

Yes, you can do all of these things. It is not true that the colours are
hard-wired.

> I have tried the options I listed above , but can't get a syntax that
> works, and haven't found the help any help at all (not for me anyway).

I presume that you are using smooth.ppp to smooth a marked point pattern,
yielding a pixel image (object of class "im") which you now want to
display in your chosen colours. So the relevant help file is
               help(plot.im)
The help file explains that the argument 'col' determines the colours that
will be used. See the examples in the help file, or example(plot.im).

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))

Adrian Baddeley




More information about the R-sig-Geo mailing list