Skip to content

Changing colour gradient in Spatstat surface plot

3 messages · Adrian Baddeley, Graham Smith, Marcelino de la Cruz

#
Graham Smith <graham.smith at myotis.co.uk> writes:
Yes, you can do all of these things. It is not true that the colours are
hard-wired.
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
#
Maybe this synthesis of both replies can help you:


library(RColorBrewer)
bl5 <- brewer.pal(5, "Blues")
mypal <- colorRampPalette(bl5)

  library(spatstat)
  data(longleaf)
  Z <- smooth.ppp(longleaf)
  plot(Z)
  plot(Z, col=mypal(12))

#or

plot(Z, col=rev(mypal(12)))



Regards,


Marcelino
At 20:59 29/04/2008, Graham Smith wrote:
________________________________

Marcelino de la Cruz Rot

Departamento de  Biolog?a Vegetal
E.U.T.I. Agr?cola
Universidad Polit?cnica de Madrid
28040-Madrid
Tel.: 91 336 54 35
Fax: 91 336 56 56
marcelino.delacruz at upm.es