[R] relabeling the x-axis of a plot with discontinuous timestamps

Uwe Ligges ligges at statistik.tu-dortmund.de
Wed Nov 5 18:44:19 CET 2008



Stoesser, Jochen wrote:
> Hi all,
> 
> I have two vectors of data:
> 
> The first vector contains timestamps (as integers), however the
> difference between these dates varies. For instance, the vector can be
> c(0, 5 , 10, 20, 25, 30) so that there is a "jump" between the third and
> the fourth element.


If these are integers (and no kind of date or time objects), then you 
may want to suppress the x axis at first (argument xaxt="n") and at it 
later on by using

axis(1, at= c(0, 5, 10, 20, 25, 30), labels= c(0, 5, 10, 20, 25, 30))

Uwe Ligges



> The second vector contains the associated values that I want to plot
> against these timestamps.
> 
> My problem is that I can't figure out how to label the x-axis with
> timestamps that are not continuous but have jumps, as in the example
> above. I tried relabeling the x-axis and using ts objects, but these
> approaches seem to require continuous time series.
> 
> I appreciate any hint.
> 
> Best,
> Jochen
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list