R赢得';不渲染

R赢得';不渲染,r,plot,shiny,R,Plot,Shiny,大家好,下面的代码有什么问题吗 output$zscore_chart <- renderPlot({ xvals <- 2:186 req(input$countrySelectZScore) idx_country = which(input$countrySelectZScore == esiCountries) max_comp_z <- max(esiData_DF[idx_country, 2:186], na.rm = TRUE

大家好,下面的代码有什么问题吗

 output$zscore_chart <- renderPlot({

   xvals <- 2:186 
   req(input$countrySelectZScore)
   idx_country = which(input$countrySelectZScore == esiCountries)



   max_comp_z <- max(esiData_DF[idx_country, 2:186], na.rm = TRUE)

   overall_max_z <- max(max_comp_z, na.rm = TRUE)

   foo = ts(esiData_DF[idx_country, 2:186], frequency = 12, start = 2001)
   dates = seq(as.Date("2001-01-01"), by = "month", along = foo)

   plot(x = 2:186, y = esiData_DF[idx_country, 2:186], type = "l", 
        xlab = "", ylab = "", col = "grey20", ylim = c(-2, overall_max_z),
        lwd=3,las=2)
    mtext("Quarterly percentage changes", side = 3, adj = 0, line = 0.1, 
      cex = 1, font = 0.5)
    axis(1, at = xvals, label = dates, cex.axis = 1, las = 2)
    mtext("Economic Sentiment Indicators", side = 3, adj = 0, 
          line = 1.2, cex = 2, font = 2)

    legend(
      "bottom", 
      lty = c(1,1), 
      lwd = c(3,3), 
      col = c("grey20", "green2"), 
      legend = c("Economic Sentiment Indicator", "GDP growth"),
      bty = "n",
      xjust = 0.5,
      yjust = 0.5,
      horiz = TRUE
    )
  }, height = 525)

output$zscore\u图表您能提供一个小的数据示例或一个可复制的示例,以便人们能够帮助您吗?已经添加了它,如果您需要更多信息,请告诉我在绘图参数中输入
xaxt='n'
。写入
axis(1,at=seq(1,圆形(长度(xvals)/12))*12,label=paste('Jan',2000+seq(1,圆形(长度(xvals)/12),sep='')
axis
中添加
las=2
,如果您想要xlabels垂直于无问题!祝你玩得愉快!