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

Roger Bivand Roger.Bivand at nhh.no
Mon Apr 28 11:15:22 CEST 2008


On Mon, 28 Apr 2008, Graham Smith wrote:

> With help from Marcelino. 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.

They are built-in, don't try to change them. Look at ?colorRampPalette and 
at ?brewer.pal in RColorBrewer, I guess that something like:

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


then use mypal(n) to get n blues. You may need rev(bl5) to get them the 
other way.

Roger

>
> 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).
>
> Can anyone help.
>
> Many thanks,
>
> Graham
>
>
>
>
>
>
>
> 	[[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>

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




More information about the R-sig-Geo mailing list