【发布时间】:2021-04-02 09:03:41
【问题描述】:
我在 R 中使用 ambient 包来生成图表。它提供了一个自定义的基础绘图方法。
library(ambient)
library(dplyr)
grid <- long_grid(x = seq(0, 1, length.out = 1000),
y = seq(0, 1, length.out = 1000))
grid <- grid %>%
mutate(
noise = fracture(gen_perlin, fbm, octaves = 4, x = x, y = y, freq_init = 5)
)
plot(grid, noise)
但是,我想使用 ggplot2 和 geom_raster 而不是基础绘图来绘制此图像。我试过做
ggplot(grid, aes(x = x, y = y, color = noise)) +
geom_raster()
但这只是产生了
知道如何用 ggplot2 制作这个吗?
【问题讨论】: