Vorrei per i grafici nella mia lucido app per cambiare colore (o di essere evidenziato) quando mi passa sopra con il mouse. Vorrei anche solo l'uscita di conte di mio grafico, invece di conte e il valore di x.
Qui è quello che sembra, nella mia Lucido App:
Per essere chiari, io vorrei che i bar che sono in bilico su di trasformare la luce blu (o un contorno nero) e solo dire "conte: 61735" senza dire "fat_infreq(da corsa): Black".
Qui di seguito, ho collegato un riproducibili esempio:
library(shiny)
library(ggplot2)
library(plotly)
library(data.table)
library(shinythemes)
library(forcats)
require(stringi)
require(stringr)
library(scales)
library(ggthemes)
library(plyr)
library(dplyr)
library(readr)
library(tidyr)
library(ggthemes)
library(forcats)
library(xtable)
library(googledrive)
library(googlesheets4)
library(gridExtra)
library(lubridate)
library(DT)
library(vroom)
library(utf8)
library(tableHTML)
library(bslib)
library(devtools)
library(readr)
library(RColorBrewer)
ethnicity <- c("Hispanic", "Non-hispanic","Hispanic","Hispanic","Hispanic","Hispanic","White","White","White","White",
"White","Hispanic","Hispanic", "Hispanic","Hispanic","Hispanic","White","White","White","White")
filtered_data <- data.frame(ethnicity)
ui <- fluidPage(
titlePanel("Example"),
mainPanel(
plotlyOutput("ethnicity_barplot")
)
)
server <- function(input, output) {
output$ethnicity_barplot <- renderPlotly({
ggplotly({
ethnicity_barplot <-ggplot(data = filtered_data, aes(x = fct_infreq(ethnicity))) +
geom_bar() +
xlab("Ethnicity") +
ylab("Number of People") +
labs(title = "Ethnicity of Defendants in New York State Courts") +
geom_bar(fill = "#327EC2") +
theme(panel.background = element_rect(fill = 'white'))+
theme(plot.background = element_rect(fill = 'white'))+
theme(plot.title = element_text(hjust = 0.5))+
theme(axis.text.x = element_text(angle = 90, hjust = 1)) +
geom_text(stat='count', aes(label=..count..), vjust = -.3)
ethnicity_barplot
})
})
}
# Run the application
shinyApp(ui = ui, server = server)
(Non tutti i pacchetti sono necessari, solo non riesco a ricordare quelli che sono)