r - ggplot图在R Shiny Dashboard中不可见
问题描述
server <- function(input, output) {
output$plot1<-renderPlot({
if(input$univariate=="Age")
{
hist(bankchurn$Age,xlab='Age',ylab='No of Customers',col= '#45b3e0' ,main="Age")
output$text1<-renderText("hi")`enter code here`
}
if(input$univariate=="Gender")
{
ggplot(data = bankchurn) +
aes(x = Gender, fill = Gender) +
geom_bar() +
scale_fill_viridis_d(option = "plasma") +
theme_minimal()
output$text1<-renderText("Gender")
}
在上面的代码中,我的第一个“if”语句正在渲染绘图,但我的第二个使用 ggplot 图的 if 语句没有在仪表板中渲染任何内容。知道如何在这种情况下显示 ggplot 图。
注意:我已经尝试将图形存储在一个变量中,但它仍然没有显示在仪表板中。
解决方案
请您提供一个带有 UI 元素的可重现示例,以便我们进一步评估需要更改的内容
推荐阅读
- ruby-on-rails - 根据 Ruby 中收到的命令调用函数
- node.js - 如何在续集中区分字段状态?
- typescript - 如何在电容器的电子构建中使用 opencv.js?ReferenceError:未定义 cv
- php - 使用 php 在编辑页面中编辑不显示 youtube 链接的记录
- c++ - Qt QRadioButton setChecked
- android - 如何在 Android 中模拟 DateFormat.is24HourFormat() 进行单元测试?
- sql - SQL 语句总和不能达到 100%
- r - 使用正则表达式从R中的字符串中提取数字
- c# - 基于主下拉列表级联两个下拉列表
- angular - 在 Angular 中动态配置 Firebase 环境