Skip to content
Back to formatted view

Raw Message

Message-ID: <CA+8X3fV=CaCapZGBU1fCTWa0ZhCVfvi_-J2JqU1jL_Z2ELVxfw@mail.gmail.com>
Date: 2018-05-06T07:52:45Z
From: Jim Lemon
Subject: Adding Year-Month-Day to X axis
In-Reply-To: <6D5F9711-CBFA-43D2-94C9-CFE847E157FA@me.com>

Hi Greg,
By default, the "axis" function puts the labels on one line and drops
labels that would overlap. When you have labels that are all the same
length, this usually results in every second, or third, or fourth
label being displayed. So you can probably get what you want by not
using staxlab. However, if you really want to use staxlab, try this:

oddones<-seq(1,length(x_yyyymmdd)-1,by=2)
staxlab(1,at=x_yyyymmdd[oddones],
 labels=format(x_yyyymmdd,"%Y-%m-%d")[oddones])

It will also work with plain "axis", which is what you seem to want.

Jim