尝试使用lubridate()中的日期/时间格式添加基本r的更多轴标记
如果这是一个混乱的问题,我深表歉意,但我不知道任何更好的格式化方法。我正在尝试在图形的X轴上获取它,显示了我数据集中所有的日期。目前,其中大约是其中的一半 - 我将附加图形的图片。我也希望每个日期之间都有更多的刻度标记。我使用lubridate()函数将我的日期/时间列组合在一起,因此这不是问题。我想知道,即使这些不是典型的数值值,即使这些轴刻度标记是否有办法。我将在下面附加代码。
PS4T1$newdate <- with(PS4T1, as.POSIXct(paste(date, time), format="%m-%d-%Y %H:%M"))
plot(average ~ newdate, data=PS4T1, type="b", col="blue")
I apologize if this is a messy question, but I don't know any better way to format it. I'm trying to get it so on the x-axis of my graph, all of the dates I have in my dataset are shown. Right now, it's just about half of them - I'll attach a picture of my graph. I would also like if there were more tick marks between each date. I used the lubridate() function to combine my date/time columns, so that's not an issue. I was wondering if there was a way to manipulate the axis tick marks even though these aren't typical numerical values. I'll attach my code below.
PS4T1$newdate <- with(PS4T1, as.POSIXct(paste(date, time), format="%m-%d-%Y %H:%M"))
plot(average ~ newdate, data=PS4T1, type="b", col="blue")
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
首先,格式日期
as.posixct
,这很重要。然后,在
subtr
上的子集,其中小时为eg'00'
。不带X轴的下一个图,并使用轴
和mtext
构建自定义轴。数据:
First, format date
as.POSIXct
, this is important for whichplot
method is called, apparently you already have done that.Then, subset on the
substr
ings where hours are e.g.'00'
. Next plot without x-axis and build custom axis usingaxis
andmtext
.Data: