Hi, I have an application with numerous ggplot outputs and am unable to hide the legend title. Here's a reprex, is there a way I can hide the legend title?
library(shiny)
library(tidyverse)
library(plotly)
ui <- fluidPage(
titlePanel("Legend Test"),
sidebarLayout(
sidebarPanel(
),
mainPanel(
plotlyOutput("Test")
)
)
)
server <- function(input, output) {
output$Test <- plotly::renderPlotly({
x <- c(1:6)
y <- c("A", "A", "A", "B", "B", "B")
z <- c("a", "a", "a", "b", "b", "b")
d <- data.frame(cbind(x, y, z))
p <-ggplot2::ggplot()+
geom_boxplot(d, mapping = aes(x = x, y = y, fill = z)) +
theme(legend.title = element_blank())
p <- ggplotly(p)
})
}
shinyApp(ui = ui, server = server)