R 闪亮:ggplot的背景图片
我制作了一个以png为背景的ggplot。没有问题的本地工作区。但作为一个有光泽的人,这个情节是行不通的 服务器.RR 闪亮: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
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)