Reputation: 13755
For the following input,
Date Visits
11/1/2010 696537
11/3/2010 799355
11/4/2010 805800
11/5/2010 701262
11/6/2010 531579
11/7/2010 690068
11/8/2010 756947
11/10/2010 701768
11/11/2010 820113
11/12/2010 645259
When I run the following code, I see 11/3/2010 still takes a space. Is there a way to remove the space taken by that date in the plot? What is the general method to skip all the dates not in the data?
f$Date <- as.Date(f$Date, "%m/%d/%Y")
plot(Visits ~ Date, f, xaxt = "n", type = "l")
axis(1, f$Date, format(f$Date, "%b %d"), cex.axis = .7)
Upvotes: 0
Views: 42
Reputation: 263471
Since you didn't seem to pick up on my comment, I'm including it here after testing. The underlying x-axis scale is now integers starting from 1.
f <- read.table(text="Date Visits
11/1/2010 696537
11/3/2010 799355
11/4/2010 805800
11/5/2010 701262
11/6/2010 531579
11/7/2010 690068
11/8/2010 756947
11/10/2010 701768
11/11/2010 820113
11/12/2010 645259", head=T)
f$Date <- as.Date(f$Date, "%m/%d/%Y")
plot(Visits ~ seq_along(Date), f, xaxt = "n", type = "l")
axis(1, seq_along(f$Date), format(f$Date, "%b %d"), cex.axis = .7)
Upvotes: 1