我正在使用R中的xyplot按日期绘制数据点。这是我的初始代码。
xyplot(data$SpainRo ~ data$Date, data= data)
我需要从某个点开始绘制数据,所以我使用了它。
xyplot(data$SpainRo ~ data$Date, data-data, xlim=as.Date(c("2020-02-27","2020-05-13")))
It works however, the first data point for February 27th falls directly on the y-axis, getting obscured. plot
我想知道如何将其向右移动,以便第一个点不在y轴上。 感谢您的任何帮助。
您需要排除不需要绘制的数据,然后展开绘制轴。
I'm assuming you are using
xyplot
from thelattice
package.Of course, I don't have your
data
because you haven't shared it in your question, so can't demonstrate that this solution works.Note that you don't need to include
data$
before formula variables if the function takes adata
argument.