r - ggplot2 计算 x_intercept
问题描述
我正在使用 ggplot2 绘制两个数据系列,如下所示,一个 Dm1 为红色,另一个 Dm2 为绿色。
p<-ggplot() +
geom_line(data= Dm1, aes(x = x, y = y , color = "Dm1")) +
geom_line(data= Dm2, aes(x = x, y = y, color = "Dm2")) +
scale_x_log10() +
scale_y_log10() +
scale_colour_manual("",
breaks = c("Dm1", "Dm2"),
values = c("red", "green"))
p+labs(x = "x in log scale", y="y in log scale", title = "help")+
theme(legend.position = c(0.8, 0.8)) +
geom_hline(yintercept = 0.006262418)
我在绿线上的位置 (y) = (0.006262418) 处画了一条线,现在我想计算它在 x 的哪个位置与红线 (x_intercept) 相交。我该怎么做?
解决方案
推荐阅读
- julia - Julia DifferentialEquation 包在更新后停止工作
- javascript - webiopi:html 到 python 到串行
- mysql - 如何补偿 MySQL TIMESTAMPDIFF 的溢出
- parsing - Elm Parser 不能在花括号内返回字符串
- embedded-linux - 如何在不重新启动整个系统的情况下在基于 Debian 的 linux 中重新启动网络接口?
- php - 设置 Rule::Unique 时如何使用 Update
- gradle - Gradle 依赖任务不会将命令行选项传递给父任务
- python - 在 python 中使用动态编程实现斐波那契
- r - 根据 data.table 中跨组的另一个变量的匹配返回一个变量
- .net - Protobuf-net 渐变刷