x轴和y轴上的标签问题

时间:2014-12-30 21:17:14

标签: r shiny forecasting

我已经搜索了好几个小时,尝试了很多东西来修复我的轴问题,但没有任何效果。

  1. 我需要反转y轴的标签。数字越低越好。因此,如果截图350000应位于底部。

  2. x轴的标签有点奇怪。而不是“27.06.14”,情节显示“2014.50”。我尝试将数据集的日期格式从“27.06.14”更改为“2014年6月27日”或“6/27/14”以及更多但结果保持不变。

  3. 我已经找到了几种解决方案1.(例如ylim = rev())和2.但是在我的情况下,这些图是在一个闪亮的应用程序中打印的,也许这就是问题所在。如果我使用解决方案,我发现应用程序直接崩溃。所有图都是通过“预测”包生成的。您可以在此处查看闪亮应用的完整代码:https://github.com/mhnierhoff/FMWT

    提前致谢。

    编辑:

    @smci

    也许我不那么清楚。当我不尝试更改轴标签时,该应用程序运行正常。

    > 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
    

    @大卫

    感谢。当我尝试这个解决方案时,我收到以下错误:

    Error in date [1]: object of type 'closure' is not indexable (translated from German)
    

    您可以在此处找到数据集: https://github.com/mhnierhoff/FMWT/blob/master/dataset/Historical_Traffic.csv

    编辑2:

    感谢大卫将此添加到情节函数中:

    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)
        }
    

    会产生美观的日期格式。

    最后,x轴看起来很棒。

    仍然打开:反转y轴。

0 个答案:

没有答案