inst/examples/image242.R

# ggplot2 绘制颜色图中色块与数值的对应关系
x = matrix(sample(24), 8)
p = ggplot(transform(expand.grid(h = 1:8, v = 1:3), z = as.vector(x)),
       aes(x = h, y = v)) +
  geom_tile(aes(fill = z)) +
  scale_fill_distiller(palette="YlOrRd") +
  geom_text(aes(label = z)) +
  theme_void()
print(p)

Try the MSG package in your browser

Any scripts or data that you put into this service are public.

MSG documentation built on July 22, 2021, 1:06 a.m.