【问题标题】:How to change Y - axis scale to uneven?如何将 Y 轴刻度更改为不均匀?
【发布时间】:2021-08-11 23:26:50
【问题描述】:

enter image description here我有数据要绘制 y 轴的 0-70 范围。 但是主图最多为 y = 5,它应该占图/比例的 75%,而 5-70 的其他数据应该只占图的 25%。 我需要在我的情节中显示标记的部分。

我尝试了一些东西但没有成功,请帮助! 谢谢

【问题讨论】:

  • ylim = c(0, 5) 是您要找的吗?在plot(...) 中设置此选项将在y = 5 处切割y 轴。不过,我不太确定您想要做什么。如果您想显示完整的范围但使较低的范围值更好地可见,请尝试使用对数刻度
  • 只需将绘图的参数ylim 设置为您想要显示的区域。你可以写plot(data, ylim=c(0,5))。然后,您的 y 轴将仅达到 5,并且某些点不会像上面那样显示。

标签: r plot line scatter-plot base


【解决方案1】:

您可以记录转换您的 y 值。看看这个带有压力数据集的例子:

par(mfrow=c(1,2))
plot(x = pressure$temperature, y = pressure$pressure, type = "l")
plot(x = pressure$temperature, y = log(pressure$pressure), type = "l")

【讨论】:

  • 实际添加日志会延迟实际绘图。
  • 我想要像 0,0.5,1,1.5,.......4.5,5,25,45,65,85 这样的点。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-06-26
相关资源
最近更新 更多