Transform color scale to probability-transformed color distribution with scale_fill_gradientn()

后端 未结 1 735
再見小時候
再見小時候 2021-02-10 20:36

I am trying to visualize heavily tailed raster data, and I would like a non-linear mapping of colors to the range of the values. There are a couple of similar questions, but the

1条回答
  •  不思量自难忘°
    2021-02-10 21:24

    This code will make manual breaks with a pnorm transformation. Is this what you are after?

    ggplot(dat, aes(x = x, y = y, fill = z)) + 
      geom_tile(width=2, height=30) +
      scale_fill_gradientn(colours=fill.colors, 
                           trans = 'norm', 
                           breaks = quantile(dat$z, probs = c(0, 0.25, 1))
      )
    

    0 讨论(0)
提交回复
热议问题