R 闪亮:ggplot的背景图片

R 闪亮:ggplot的背景图片,r,shiny,ggplotly,R,Shiny,Ggplotly,我制作了一个以png为背景的ggplot。没有问题的本地工作区。但作为一个有光泽的人,这个情节是行不通的 服务器.R library(shiny) library(shinydashboard) library(shinyWidgets) library(dashboardthemes) library(DT) library(png) library(rasterImage) library(ggpubr) library(plotly) # Define server logic requ

我制作了一个以png为背景的ggplot。没有问题的本地工作区。但作为一个有光泽的人,这个情节是行不通的

服务器.R

library(shiny)
library(shinydashboard)
library(shinyWidgets)
library(dashboardthemes)
library(DT)
library(png)
library(rasterImage)
library(ggpubr)
library(plotly)

# Define server logic required to draw a histogram
shinyServer(function(input, output, session) {

    output$ShootPosition <- renderPlotly({

        data <- data.frame(x = rnorm(100),
                           y = rnorm(100))
        ggplot(data, aes(x, y), tooltip = TRUE) +
               background_image(readPNG("test.png")) +
               geom_point()
      }) 

    }
)
库(闪亮)
图书馆(shinydashboard)
图书馆(shinyWidgets)
库(仪表板主题)
图书馆(DT)
图书馆(png)
库(光栅图像)
图书馆(ggpubr)
图书馆(绘本)
#定义绘制直方图所需的服务器逻辑
shinyServer(功能(输入、输出、会话){

输出$ShootPosition在服务器部分,您没有为
renderPlotly
定义
ggplotly
对象。只有
ggplot
对象将不会在
renderPlotly
中呈现。请定义
pShow我们您的
闪亮的
代码。
ggplot
函数本身不足以理解您要呈现的内容e缺失。是否必须使用plotly?如果改用plotOutput和renderPlot,一切都会正常工作不。我有空,但我希望绘图尽可能具有交互性。
library(shiny)
library(shinydashboard)
library(shinyWidgets)
library(dashboardthemes)
library(DT)
library(png)
library(rasterImage)
library(ggpubr)
library(plotly)

header <- dashboardHeader(
    title = "Test"
)

sidebar <- dashboardSidebar(
    sidebarMenu(
        menuItem("Tables", icon = icon("table"), 
                 menuSubItem("Players", tabName = "Tables_Players")
        )
    )
)

body <- dashboardBody(
    tabItems(
        tabItem("Tables_Players",
                fluidPage(
                    titlePanel("Charts Players"),
                    fluidRow(
                        plotlyOutput("ShootPosition", height = '800px')
                    )
                )
        )
    )
)


ui = dashboardPage(
    header,
    sidebar,
    body)