Получить заголовок ggplot из выбранного варианта с помощью radioButton - PullRequest
2 голосов
/ 09 мая 2020

Я пытаюсь получить title графа ggplot из выбранного варианта из radioButton , который выбирает пользователь. Я очень благодарен за любую помощь.

Вот соответствующие фрагменты кода с поддельными данными:

Боковая панель

sidebar <- dashboardSidebar(sidebarMenu(
  menuItem("Dashboard", tabName = "Data", icon = icon("dashboard")),
  radioButtons(inputId = "Partner", label = "Choose Partnership:", selected = "A",
             choices = c("A", "B", "C", "D"))),

Body

body <- dashboardBody( 
   fluidRow(
    tabBox(title = "Company",
    tabPanel("Partner", plotOutput("partner"))))
)

Сервер

output$partner <- renderPlot({
        all_part  %>% 
        filter(partner == input$Partner) %>%
        ggplot(aes(x=level, fill = level)) +
        geom_bar() +
        ylab("Number of Participants") +
        theme_tufte() +
        ggtitle(" ") +   # How can I get this from the radiobutton choice ?#
        theme(plot.title = element_text(colour="black", size=14, face="bold"), 
              axis.title.x = element_text(color="black", size=10, face="bold"),
              axis.title.y = element_text(color="black", size=10, face="bold")) +
        theme(plot.subtitle = element_text(color="#0066CC", size=12, face="bold")) +
        theme(legend.title = element_text(colour="black", size=10, face="bold")) +
        theme(legend.position = "none") +
        theme(plot.background = element_rect(fill = "#CCFFFF"))  
})
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...