나는 그래프에 대해 내 응용 프로그램을 변경 색상(강조된)위에 마우스를 올려놓은 경우에 그들에게 내 마우스입니다. 또한 것처럼 그들에게만 출력의 수를 그래프에,대신 계산 및 x-값입니다.
명확하게하기 위해,나는 바 나를 유혹하는 빛을 차례로 블루(또는 윤곽)고만 말하는"count:61735"말하지 않고"fat_infreq(경주):Black".
아래,내가 연결된 재현할 수 있는 예제:
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)
(하지 않는 모든 패키지를 필요로 그냥을 기억할 수 없는 사람입니다)