0

I used the following to generate a histogram

mi= 1425168014.519
ma= 1427919527.540
b=mi+rnorm(2000,sd=1)*(ma-mi)
hist(as.POSIXct(b, origin="1970-01-01"),breaks=50, freq = TRUE,axes=F)
axis.POSIXct(1, at=seq(as.Date("2015-01-01"), as.Date("2015-04-01"), by="1 days"), format="%d %b %y")

But the specified dates are not shown in entirety. It only shows as minor ticks. I want it to be shown as labels.

Qiang Li
  • 10,593
  • 21
  • 77
  • 148

1 Answers1

0

First, you probably need to make your viewing window bigger- I at least saw two dates when I ran your code. Second, you will want your axis labels to be perpendicular to the axis, which you can do with the las option (relevant answer).

axis.POSIXct(1, at=seq(as.Date("2015-01-01"), as.Date("2015-04-01"), by="1 days"), 
  format="%d %b %y", las=2)

If you do this, all of your labels will be on top of each other, so you will probably want to increase your interval to something larger, like 10 days.

axis.POSIXct(1, at=seq(as.Date("2015-01-01"), as.Date("2015-04-01"), by="10 days"), 
format="%d %b %y", las=2)
Community
  • 1
  • 1
waternova
  • 1,472
  • 3
  • 16
  • 22