r - 闪亮应用程序条形图中的图例名称未显示
问题描述
我无法找出条形图未显示图例名称的原因。
图例名称应显示为行名称。但它以数字显示。
library(shiny)
library(shinydashboard)
library(ggplot2)
bld <- read.csv("C:/Users/velumani_d/Documents/My Dashboard/BLD.csv")
bldr <- rownames(bld)
bldn <- nrow(bld)
ui<- shinyUI(dashboardPage(dashboardBody(fluidPage(
titlePanel("Block Level"),
sidebarLayout(
sidebarPanel(
selectInput("Visitors", "Select column name:", choices =
colnames(bld)), hr(), helpText("Data from DESH")),
mainPanel(plotOutput("Bar_chart"))
)
))))
server <- shinyServer(function(input,output){
output$Bar_chart <- renderPlot({
barplot(bld[,input$Visitors], main = input$Suspected, ylab="No of
visitors", xlab = "Blocks", legend = bldr, beside = FALSE, col = 1:bldn)
})
})
shinyApp(ui, server)
数据集:
Block Visitors Suspected
Amingaon 75 40
Azara 68 23
Chaygaon 80 30
Hajo 728 200
Kamalpur 1814 500
N.Guwahati 529 250
Rangia 49 24
Sualkuchi 1534 400
解决方案
推荐阅读
- javascript - 是否可以在减速器中使用 getState() ?
- java - 我在 ubuntu 18.4 中安装 tomcat 时遇到问题
- javascript - 条件语句无法正常运行
- powershell - 使用 Ansible 在后台启动 Windows Web 服务器
- python - 按日期计算布尔变量
- javascript - 从它更改路径时反应js不会因为它没有完成加载页面
- paypal - 向客户发送付款收据
- php - 我无法连接 PHP CURL。我收到一个禁止的错误
- html - 引导表内的空按钮。如何设置为 100% 高度?
- angular - NZ Zorro,Ant design nz-table 动态列不对齐