spatstat - how to control transparency of ppp density plot -


i trying use layered methods overlay few spatstat spatial objects. these objects same window. have im layer (density) ppp. want make layer bit transparent in order have better visibility of other objects in layered object.

how can control transparency of density plot (im)? there alpha or transparency parameter plot.im ?

update:

library(spatstat) pipes=simplenet plot(pipes) point_net = as.ppp(runifpoint(10, win = window(pipes))) point_surface = density(point_net) plot(point_surface) layers= layered(point_surface, point_net, pipes) plot(layers) 

enter image description here

here , have plotted 3 layers. can see density plot has dark blues , reds. yes, can plot lines , points different colours make them visible, nice simple stacked line, point plots , add little bit of transparency density (im) plots.

the purpose avoid complex customized plot colours , explain colleagues.

thank you.


first commands original post:

library(spatstat) pipes=simplenet point_net = as.ppp(runifpoint(10, win = window(pipes))) point_surface = density(point_net) layers= layered(point_surface, point_net, pipes) plot(layers) 

you need provide different colourmap plot.im. there 2 ways can this:

  1. plot each layer individually using add = true subsequent layers , provide colour map when plot im object.
  2. pass list of plot arguments when plot layered object have created above.

i find first option easier illustration, first. default colourmap of spatstat 29th kovesi colour sequence (?kovesi more details on these sequences):

def_col <- kovesi$values[[29]] head(def_col) #> [1] "#000c7d" "#000d7e" "#000d80" "#000e81" "#000e83" "#000e85" 

to add transparency can use to.transparent choice of fraction more/less transparency:

def_col_trans <- to.transparent(def_col, fraction = 0.7) head(def_col_trans) #> [1] "#000c7db3" "#000d7eb3" "#000d80b3" "#000e81b3" "#000e83b3" "#000e85b3" 

now need use colourmap:

plot(point_surface, col = def_col_trans) plot(point_net, add = true) plot(pipes, add = true) 

to layered object have make list of plot argument lists (containing null if don't have additional arguments):

layer_args <- list(list(col = def_col_trans),                    list(null),                    list(null)) plot(layers, plotargs = layer_args) 


Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -