我很好奇,是否有人知道如何创建一个带有isoquant曲线的热图,该曲线识别所有的x和y组合,其乘积等于某个常数。最后的产品应该如下所示:
下面是生成我的绘图所用的代码,但是现在我无法像上面的图片所描述的那样在图中得到曲线:
vs.vpd.by.drop_days <- ggplot(event_drops, aes(vs, vpd)) +
geom_point(aes(color = day_since), size = 2, alpha = 0.2) +
scale_color_gradientn(colors = c("darkblue","green","yellow","red"),
breaks = c(0,25,50,75),
limits = c(0,75),
name = "Days since \n first drop") +
ggtitle("Drops by VPD and Wind Speed") +
theme(plot.title = element_text(size = 18, face = "bold", hjust = 0.5),
axis.title = element_text(size = 15)) +
xlab(label = "Wind Speed (mph)") +
ylab(label = "Vapor Pressure Deficit") +
expand_limits(x = 0, y = 0) +
scale_x_continuous(expand = c(0, 0), limits = c(0,20)) +
scale_y_continuous(expand = c(0, 0), limits = c(0,5))
vs.vpd.by.drop_days发布于 2022-04-06 19:08:12
实现这一目标的一个选择是geom_function。
使用mtcars作为示例数据:
library(ggplot2)
ggplot(mtcars, aes(hp, mpg, color = disp)) +
geom_point() +
geom_function(fun = function(x) 3000 / x)

https://stackoverflow.com/questions/71772300
复制相似问题