geom_contour_filled colour palette
我试图运行以下代码,但似乎无法将调色板更改为 ColorBrewer 的 Spectral 调色板。想法?
1 2 3 4 5 6 7 8 9 10 11 12 | maya <- tibble( mass = seq(1, 10, length.out = 10), mois = seq(11, 20, length.out = 10) ) %>% expand(mass, mois) %>% mutate( diff = mois - mass * runif(1) ) %>% ggplot(aes(mass,mois,z = diff)) + geom_contour_filled() + scale_fill_distiller(palette ="Spectral") maya |
如果我理解正确,也许你在追求像
1 2 3 4 5 6 7 8 9 10 11 12 13 | library(tidyverse) tibble( mass = seq(1, 10, length.out = 10), mois = seq(11, 20, length.out = 10) ) %>% expand(mass, mois) %>% mutate( diff = mois - mass * runif(1) ) %>% ggplot(aes(mass,mois,fill = diff)) + geom_raster(interpolate = TRUE) + scale_fill_distiller(palette ="Spectral") |
为了扩展,
中的插值之类的东西