I have googled around for hours and tried a bunch of things to fix my axis problems, but nothing works out.
I need to reverse the labels of the y-axis. The lower the number the better. So in case of the screenshot 350000 should be at the bottom.
The labels of the x-axis are kind of weird. Instead of "27.06.14" the plot shows "2014.50". I tried to change the date format of the data set from "27.06.14" to "27 June 2014" or to "6/27/14" and more but the result stays the same.
I already found several solutions for 1. (e.g. ylim = rev()) and 2., but in my case the plots are printed within a shiny app and maybe this is the problem. If I use the solutions I found the app directly crashes. All plots are generated through the "forecast" package. You can check the whole code of the shiny app here: https://github.com/mhnierhoff/FMWT
Thanks in advance.
EDIT:
@smci
Maybe I wasn't that clear. The app works perfectly, when I don't try to change the axis labels.
> sessionInfo()
R version 3.1.2 (2014-10-31)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
locale:
[1] de_DE.UTF-8/de_DE.UTF-8/de_DE.UTF-8/C/de_DE.UTF-8/de_DE.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] lubridate_1.3.3 markdown_0.7.4 rmarkdown_0.3.3 knitr_1.8
[5] forecast_5.6 timeDate_3011.99 zoo_1.7-11 shinyapps_0.3.63
[9] shinyIncubator_0.2.1 shiny_0.10.2.1
loaded via a namespace (and not attached):
[1] colorspace_1.2-4 digest_0.6.6 evaluate_0.5.5 formatR_1.0 fracdiff_1.4-2
[6] grid_3.1.2 htmltools_0.2.6 httpuv_1.3.2 lattice_0.20-29 memoise_0.2.1
[11] mime_0.2 nnet_7.3-8 parallel_3.1.2 plyr_1.8.1 quadprog_1.5-5
[16] R6_2.0.1 Rcpp_0.11.3 RJSONIO_1.3-0 stringr_0.6.2 tools_3.1.2
[21] tseries_0.10-32 xtable_1.7-4
@David
Thanks. When I try this solution I get the following error:
Error in date [1]: object of type 'closure' is not indexable (translated from German)
You can find the data set here: https://github.com/mhnierhoff/FMWT/blob/master/dataset/Historical_Traffic.csv
EDIT 2:
Thanks to David adding this to the plot function:
plotInput <- function() {
plot(forecast(getModel(), h=input$ahead),flty = 3, axes = FALSE)
a <- seq(as.Date(aTR$Date, format = "%d.%m.%y")[1] + 1,
by = "months", length = length(date) + 11)
axis(1, at = as.numeric(a)/365.3 + 1970,
labels = format(a, format = "%d/%m/%Y"), cex.axis = 0.9)
axis(2, cex.axis = 0.9, ylog = T)
}
results in good looking date format.
Finally the x-axis looks great.
Still open: to reverse the y-axis.