Reputation: 821
This is a follow on from my last question relating to plotting timestamps in R. I am using the same XML file. The question has been answered and is working except for the following command:
qplot(timeStamp,Price,data=test.df,geom=c("point","line"),color="Measured", shape="Measured",linetype="Measured", scale_y_continuous(limits = c(10,26)))
The problem is that the line is not shown on the graph, but the points are. I have searched online but there does not seem to be a solution. Is there other options / additional commands I need to get the line to display?
Sorry if this seems such a simple question but I am a total beginner and have found the people on this site to be extremely helpful and this has been very much appreciated.
Upvotes: 0
Views: 792
Reputation: 103898
Your problem is probably that you haven't converted timeStamp
to a time stamp - it's probably currently stored as a factor. Without seeing your data I can't tell you exactly what you need to do to fix it, but it's likely to involve strptime
.
Upvotes: 2
Reputation: 9037
When the x-axis is a factor, you need to define the groups across which you want to draw the line. That is, if you want to draw a line for every unique group defined by A
, you would pass group = A
to qplot()
. If the lines are going to be defined by a combination of A
and B
, you would pass group = A:B
.
With this data, since there aren't any groups, defined in the data frame, pass group = 1
to qplot()
. That should do the trick.
Upvotes: 1