简体   繁体   中英

R Shiny Horizontal Reactive Axis Labels

I have the following code in R shiny that creates a graph with reactive labels. The y labels are the choice name (not value) of the user input however they are currently being displayed vertically whereas I need them horizontal.

output$colm <- (renderPlot({barplot(
  as.numeric(input$vars),
  beside = TRUE,
  main = "Gap Analysis",
  xlab = "Mean Difference",
  horiz = TRUE,
  xlim = c(-1, 1),
  ylim = c(0, 5),
  ylab = names(gapChoices[input$vars == gapChoices]),
  col = cols,
  las = 1)}))

在此处输入图片说明

Any ideas on how to fix this?

You are using

las = 1

That should work. Are you getting any errors when plotting? You may need to use

par(las=1)

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM