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.
我绘制了一条表达式曲线,即curve(-log((1-x)/0.9999)/x,ylim=c(0,4))。但是,我想看到相反的关系,即y changes over x而不是x changes over y. 是否有任何 R 函数可以自动绘制它?还是可以解方程的函数?
curve(-log((1-x)/0.9999)/x,ylim=c(0,4))
y changes over x
x changes over y
有两个明显的选择:
(i) 以代数方式推导出反函数(在这种情况下是微不足道的),
也就是说,取 y=-log((1-x)/0.9999) 并使 x 成为等式的主题(如果不清楚如何继续,这将需要适用于 math.SE 问题的简单代数操作).. .
...然后curve在结果上使用,或者
curve
(ii) 使用plot而不是curve绘制一组 (x,y) 对(设置type="l"以获得曲线),并在调用 plot 时简单地交换哪个是 x 和哪个是 y。
plot
type="l"