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

后端 未结 1 1153
情话喂你
情话喂你 2021-02-10 21:06

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

    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)
提交回复
热议问题