I am trying to set the height of a plot, but cant seem to get the height parameter in the plot function to actually do anything. Does anyone have any suggestions?
output$probability_chart <- renderPlot({
xvals <- 1:17
req(input$countrySelectProbabilities)
idx <- which(input$countrySelectProbabilities==FVI_DATA_ALL_COUNTRIES)
max_comp_prob <- max(Composite_Probabilities_1_DF[idx, 2:18], na.rm=TRUE)
max_bank_prob <- max(Banking_Probabilities_1_DF[idx, 2:18], na.rm=TRUE)
max_curr_prob <- max(Currency_Probabilities_1_DF[idx, 2:18], na.rm=TRUE)
max_sove_prob <- max(Sovereign_Probabilities_1_DF[idx, 2:18], na.rm=TRUE)
max_sudd_prob <- max(Sudden_Stop_Probabilities_1_DF[idx, 2:18], na.rm=TRUE)
overall_max_prob <- max(max_comp_prob, max_bank_prob, max_curr_prob, max_sove_prob, max_sudd_prob, na.rm=TRUE)
plot(x = xvals, y=Composite_Probabilities_1_DF[idx, 2:18], type = "l"
, xlab = "", ylab = "", col="grey20", ylim = c(-10, overall_max_prob), lwd=3, las=2)
mtext("Financial Vulnerability Indicator", side=3, adj=0, line=1.2, cex=2, font=2)
mtext("Probability", side=3, adj=0, line=0.1, cex=1, font=0.5)
axis(1,at=xvals,label=dates, cex.axis=1, las=2)
lines(xvals, Banking_Probabilities_1_DF[idx, 2:18], col="green2", lwd=3)
lines(xvals, Currency_Probabilities_1_DF[idx, 2:18], col="purple", lwd=3)
lines(xvals, Sovereign_Probabilities_1_DF[idx, 2:18], col="red", lwd=3)
lines(xvals, Sudden_Stop_Probabilities_1_DF[idx, 2:18], col="orange", lwd=3)
legend(
"bottom",
lty=c(1,1,1,1),
lwd=c(3,3,3,3),
col=c("grey20", "green2", "purple", "red", "orange"),
legend = c("Composite", "Banking", "Currency", "Sovereign", "Sudden Stop")
,ncol=5
)
})
在server.R
您应该添加旁边的高度参数中plotOutput
:
plotOutput("plot", height=800)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.