Open GaojunShen opened 8 years ago
which file(s)?
as.Date(DataSet$Date, format("%m/%d/%Y"))[1] [1] "2012-01-01" plot(as.Date(DataSet$Date, format("%m/%d/%Y")))
This one : https://github.com/GaojunShen/RTEAnalytics/blob/master/RTEAnalytics-Gaojun-01.Rmd @tevgeniou
My problem is when I used 'as.Date', the x axis is number of days not the exact date after plot. How to solve that?
not sure what you want to do, but try this. maybe something like this?
x = as.Date(DataSet$Date, format("%m/%d/%Y")) plot(x, axes=FALSE, type = "l", ylab = "y axis label bla", xlab="x axis label bla",main="main label bla", lwd=1.4) axis(1,at=seq(1,length(x),length.out=10),labels=DataSet$Date[seq(1,length(x),length.out=10)],cex.axis=0.8,las=3) axis(2,cex.axis=1.1)
play around with length.out, too.
In the first chart, the graph is ok but when I look at the x-axis, the date is not from 2012-2013-2014 but 2012-2012-2014....and it plots 2013 in the end which is weird. I got the same problem for lines 27-32 which the x-axis is disordered like this
it prints the labels at "positions" at=seq(1,length(x),length.out=10),labels=DataSet$Date[seq(1,length(x),length.out=10)]
of course you can manually ask it to print the labels at whatever positions you like, but if your data has, for example, 200 datapoint for 2012 and 5 points for 2013 clearly 2012 should appear more often if you "equally-space" the x-axis labels.
try also to see what this does: seq(1,100,5)
etc (help(seq)
)
I am trying to plot a graph by this this command:
but everytime I got the graph with date not in order, would you please help me handle this? @gillesalex07 @brrav0 @Sefimenko