程序问答   发布时间:2022-06-01  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了在 DT Shiny Table 工具提示中显示 ggplot大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

如何解决在 DT Shiny Table 工具提示中显示 ggplot?

开发过程中遇到在 DT Shiny Table 工具提示中显示 ggplot的问题如何解决?下面主要结合日常开发的经验,给出你关于在 DT Shiny Table 工具提示中显示 ggplot的解决方法建议,希望对你解决在 DT Shiny Table 工具提示中显示 ggplot有所启发或帮助;

我正在尝试在工具提示中显示绘图。我只希望在我悬停在 mpg 行上方时显示工具提示。我试图实现这样的目标:https://laustep.github.io/stlahblog/posts/DTqTips.html,但结果很短。下面是我想显示的图的 reprex 解决方案。

library(shiny)
library(DT)
library(tIDyversE)

shinyApp(
  ui = fluIDPage(
    SELEcTinput('cylSELEct',choices = c(4,6,8),label ="SELEct the # of cylinders"),datatabLeoutput('table'),),server = function(server,input,output) {
    
    cars <- reactive({
      mtcars %>%
        filter(cyl == input$cylSELEct) %>%
        group_by(am) %>%
        summarise(across(everything(),mean))
    })
    
    p <- renderPlot({ 
      cars() %>%
      ggplot(aes(x = am,y=mpg)) +
      geom_bar(stat = 'IDentity')
    })
    
    output$table <- renderDatatable({
      datatable(cars()

      )
    })
  }
)

解决方法

不确定这是否是您要查找的内容,但一种选择是使用 tippy 包来创建列标题。

library(shiny)
library(tippy)


tippy("Example Text",tooltip = paste(img(src="http://tippy.john-coene.com/logo.png")),allowHTML = TRUE,placement = "bottom",theme = "light"
)

然它只适用于静态图像,但您可以简单地保存输出图并在工具提示中引用它。

大佬总结

以上是大佬教程为你收集整理的在 DT Shiny Table 工具提示中显示 ggplot全部内容,希望文章能够帮你解决在 DT Shiny Table 工具提示中显示 ggplot所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。
标签:ggplot