小编K.H*_*Hua的帖子

ggplot 扩展图例颜色条

我正在尝试在 ggplot 上制作热图。我有一个类似于下面的数据框

wday    hour    quant
Mon 0   1.2346944
Tue 0   0.8418860
Wed 0   0.8904375
Thu 0   0.8906767
Fri 0   1.0761553
Sat 0   2.1095617
Sun 0   2.1421696
Mon 1   2.9178615
Tue 1   0.7481875
Wed 1   0.6200556
Thu 1   0.5530000
Fri 1   0.3852611
Sat 1   0.4791192
Sun 1   1.0958043
Mon 2   2.8627222
Tue 2   0.7989769
Wed 2   0.4209105
Thu 2   0.6512810
Fri 2   0.5047176
Sat 2   0.6544059
Sun 2   0.8167846
Run Code Online (Sandbox Code Playgroud)

我的代码是:

ggplot(df , aes(x = hour, y = wday)) +
  geom_raster(aes(fill …
Run Code Online (Sandbox Code Playgroud)

r legend heatmap ggplot2

4
推荐指数
1
解决办法
1773
查看次数

将 Rintrojs 与闪亮仪表板相结合

我刚刚开始使用rintrojs包,我想将它与该shinydashboard包混合起来。我特别想采取以下步骤:

  • 侧边栏,
  • 标题(图中为蓝色)
  • 允许关闭和打开侧边栏的按钮(我在图像中用红色包围)

在此输入图像描述

我尝试从他们的 github 页面上的示例开始,并在侧边栏上添加第六步,但它返回了一个错误

library(rintrojs)
library(shiny)
library(shinydashboard)

# Define UI for application that draws a histogram
ui <- shinyUI(
  dashboardPage(
    dashboardHeader(title = "Basic dashboard"),
    introBox(dashboardSidebar(

    ),data.step = 6,
    data.intro = 'This is the sidebar'),
    dashboardBody(
      fluidPage(
        introjsUI(),

        # Application title
        introBox(
          titlePanel("Old Faithful Geyser Data"),
          data.step = 1,
          data.intro = "This is the title panel"
        ),

        # Sidebar with a slider input for number of bins
        sidebarLayout(sidebarPanel(
          introBox(
            introBox(
              sliderInput(
                "bins",
                "Number of …
Run Code Online (Sandbox Code Playgroud)

r shiny intro.js shinydashboard

4
推荐指数
1
解决办法
1225
查看次数

仅包含一个元素的 PickerInput 子类别

我一直在尝试从包ShinyWidgets中制作带有子类别的pickerInput

library(shiny)
library(shinyWidgets)

ui <- fluidPage(
  tags$h2("Select / Deselect all"),
  pickerInput(
    inputId = "p1",
    label = "Select all option",
    choices = list(subA = c("a","b","c"),
                   subB = c("a"),
                   subC = c("a","b")),
    multiple = TRUE,
    options = list(`actions-box` = TRUE)
  ),
  verbatimTextOutput("r1")
)

server <- function(input, output, session) {
  output$r1 <- renderPrint(input$p1)
}

shinyApp(ui = ui, server = server)
Run Code Online (Sandbox Code Playgroud)

问题是,当一个子类别只有一个元素时,输出有点奇怪,并且显示的内容与其他子类别不同。在我的示例中,我可以选择子类别的名称 (subB),但不能选择该子类别的元素 (“a”)

在此输入图像描述

有没有办法来解决这个问题?

r shiny shinywidgets pickerinput

1
推荐指数
1
解决办法
532
查看次数