I produced a ggplot with a png as background. Local this workspace without a problem. But as a shiny the plot is not working.
Server.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()
})
}
)
ui.R
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)
The goal is to produce a shot map for ice hockey.