1
我将一些温度数据绘制为深度的函数。但我希望它对非科学家更友好,并且清楚地表明,顶部是水面。任何想法如何做到这一点? (红利艺术浪!)在ggplot2中绘制“水面”
这里有一些选择至今:
library(dplyr); library(ggplot2); library(magrittr);
temperature <- rnorm(30, mean = 20)
depth <- seq(0:29)
df <- data.frame(temperature, depth)
no_surface <- df %>%
ggplot(aes(y = depth, x = temperature, colour = temperature)) +
geom_path(size = 2) +
scale_y_reverse() +
scale_colour_gradient(low = "blue", high = "red")+
theme_classic() +
theme(legend.position = "none")
flat_surface <- no_surface + geom_hline(yintercept = 0)
wavy_surface <- no_surface + stat_function(fun = function(x)sin(x^1.5),
size = 1)