如何格式化 R 中的轴、年份和月份
我有以下数据集
1890 mar 0.4
1890 apr 0.8
1890 may 1.0
...
1989 jan 0.2
1989 feb 0.4
1989 mar 0.5
如何在 R 中绘制线图,并在 x 轴上绘制年,每 5 年显示一次?
我的问题不在于制作情节,而是只显示我想要的年份,并将它们放在那一年的年初。所以我不想在四月勾选,而是在一月勾选。
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这应该可以帮助您开始:
This should get you started:
默认情况下,使用 zoo 作为绘图,您会得到 rcs (正确!)建议的内容线和同一轴:
help(plot.zoo)
示例展示了如何进行更奇特的日期索引,本质上是 rcs 向您展示的内容,但通过附加格式,例如,如果您将
at< /code> 和
lab
你得到的蜱虫也更少。You get what rcs (correctly !) suggested by default using zoo as plot with lines and the same axis:
The
help(plot.zoo)
examples show to do fancier date indexing, essentially what rcs showed you but with an additional formatting via, say,If you subset
at
andlab
you get fewer ticks too.