Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想使用 ggplot 创建散点图,其中 y 缩放为1/y(我的 y 都是正数),但标有y. 我怎样才能做到这一点?
1/y
y
我试图用绘图+ scale_y_continuous(trans='recip')但得到以下错误:
+ scale_y_continuous(trans='recip')
获取错误(as.character(FUN),模式=“功能”,环境=环境): 找不到模式“功能”的对象“recip_trans”
谢谢,
像这样的东西?
library(ggplot2) library(scales) df = data.frame(x = c(1:46), y = seq(500, 5000, 100)) ggplot(df, aes(x, y)) + geom_point() + scale_y_continuous(trans = reciprocal_trans(), breaks = c(500, 1000, 2000, 5000))