0

I am using the hts package, which in it's newest version 4.x has a better label naming handling. Unfortunately stll labels get cropped in plots of an hts object.

bts <- ts(5 + matrix(sort(rnorm(500)), ncol=5, nrow=100))
y <- hts(bts, nodes=list(2, c(3, 2)))
plot(y, levels = c(0, 1))

This is especialy a problem when handling lengthy label names. Any idea how to avoid this cropping?

Plot hts

Daemon Painter
  • 3,208
  • 3
  • 29
  • 44
user2030503
  • 3,064
  • 2
  • 36
  • 53

1 Answers1

1

Maybe you could try to use plot(y, levels = c(0, 1), labels = FALSE) and add labels yourself using the text() function.

Alternatively, plot(y, include = 70) gives 70 historical observations to get rid of the overlapping labels, if showing the whole time series is not necessary.

Earo Wang
  • 789
  • 5
  • 8
  • Thanks, but I feel both solutions quite hacky, which should not be necessary. I was looking for something which needs less manual control. Maybe the hts package is too limited right now. Hope Rob can consider for future versions. I raised an issue on Github https://github.com/robjhyndman/hts/issues/2 . – user2030503 Mar 20 '14 at 20:31
  • I tried to fix that, but the base `plot()` function is so limited. Because this also depends on the size of user's plotting window. – Earo Wang Mar 25 '14 at 01:07