如何在基本 R 中创建一个 Y 轴标签相反的绘图?
要创建 Y 轴标签相反的绘图,我们需要对 Y 轴标签使用 rev 函数与 ylim,但还需要为 Y 轴值定义范围,否则 R 会抛出错误。例如,如果我们有两个名为 x 和 y 的向量,然后可以使用 plot(x,ylim=rev(range(y))) 创建 Y 轴标签相反的绘图。
示例
x<-1:10 y<-1:10 plot(x,y)
输出
创建 Y 轴标签相反的绘图 −
Explore our latest online courses and learn new skills at your own pace. Enroll and become a certified expert to boost your career.
示例
plot(x,ylim=rev(range(y)))
输出
广告