-
DescriptionI've been able to render a Quarto file in RStudio with an interactive plot_ly graph (Run Document), but the html file produced has a blank space where the graph should be. Perhaps not surprisingly, when I publish to Quarto Pubs there is still no embedded graph. I was able to publish to shinyapps.io and the interactive graph was included (see: https://curtisld.shinyapps.io/nla_explore/). The project can be found on github: https://github.com/KingCounty-Science/nla_explore I did update RStudio and Quarto to version 1.5.57 but then I could no longer publish to Quarto getting the message: "ERROR: The specified path (.) is not a website, manuscript or book project so cannot be published." I've attached images of the rendered figure and the html file with the blank space where the figure should be. The qmd file looks like this: ---
title: "Compare King Co Lakes With National Lakes Assessment Data"
author: "Curtis DeGasperi"
format: html
server: shiny
date: today
---
## Using Puget Lowland National Lakes Assessment (NLA) data to put King Co. stewardship lakes in context
```{r}
#| echo: false
#| warning: false
# Load data for plotting
suppressPackageStartupMessages(library(tidyverse, quietly = T))
suppressWarnings(library(lubridate))
suppressWarnings(library(plotly))
### King Co and NLA data - Chla and TP
nla_ecdf.chla <- readRDS('nla_ecf.chla.RDS')
nla_ecdf.tp <- readRDS('nla_ecf.tp.RDS')
###
```
```{r}
#| echo: false
#| warning: false
# library(shiny)
nla_ecdf.chla <- readRDS('nla_ecf.chla.RDS')
nla_ecdf.tp <- readRDS('nla_ecf.tp.RDS')
lakes <- sort(unique(nla_ecdf.chla$SiteName[!nla_ecdf.chla$Type=='NLA']))
selectInput("SiteName", "Choose Lake:", lakes, selected = "Welcome")
###
```
```{r}
mainPanel(plotlyOutput('graph'))
###
```
```{r}
#| echo: false
#| warning: false
#| context: server
suppressWarnings(library(plotly))
nla_ecdf.chla <- readRDS('nla_ecf.chla.RDS')
nla_ecdf.tp <- readRDS('nla_ecf.tp.RDS')
a1 <- reactive({
# m <- nla_ecdf.chla[nla_ecdf.chla$SiteName=='Star', ]
m <- nla_ecdf.chla[nla_ecdf.chla$SiteName==input$SiteName, ]
a <- list(
x = log10(m$Value),
y = m$ecdf,
text = m$SiteName,
xref = "x",
yref = "y",
showarrow = TRUE,
arrowhead = 7,
ax = 70,
ay = 0
)
return(a)
})
a2 <- reactive({
# m <- nla_ecdf.tp[nla_ecdf.tp$SiteName=='Star', ]
m <- nla_ecdf.tp[nla_ecdf.tp$SiteName==input$SiteName, ]
a <- list(
x = m$Value,
y = m$ecdf,
text = m$SiteName,
xref = "x",
yref = "y",
showarrow = TRUE,
arrowhead = 7,
ax = 70,
ay = 0
)
return(a)
})
output$graph <- renderPlotly({
fig1 <- plot_ly(nla_ecdf.chla, x = ~log10(Value), y = ~ecdf, color = ~Type, showlegend = FALSE, type = 'scatter', mode = 'markers', hoverinfo = 'text',
text = ~paste('</br> Value: ', round(Value,1),
'</br> Fn(Value): ', round(ecdf,2),
'</br> Lake: ', SiteName))
fig1 <- fig1 %>% layout(annotations = a1(), title = "Chlorophyll a (µg/L)", xaxis = list(title = "log10[Chlorophyll a (µg/L)]", size = 14))
fig2 <- plot_ly(nla_ecdf.tp, x = ~Value, y = ~ecdf, color = ~Type, type = 'scatter', mode = 'markers', hoverinfo = 'text',
text = ~paste('</br> Value: ', round(Value,1),
'</br> Fn(Value): ', round(ecdf,2),
'</br> Lake: ', SiteName))
fig2 <- fig2 %>% layout(annotations = a2(), title = "Compare King Co Lakes with National Lakes Assessment Data", xaxis = list(title = "Total Phosphorus (µg/L)", size = 14))
subplot(fig1,fig2,shareY=TRUE, titleX = TRUE, titleY = TRUE)
})
```
|
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 6 replies
-
Could you share a small example of the issue? You should not use inline R expression, especially because it's not necessary https://quarto.org/docs/reference/dates.html Shiny documents requires some special treatments, did you follow: https://quarto.org/docs/interactive/shiny/running.html Finally, you are using Quarto 1.2. Current stable release is 1.5. Please upgrade. |
Beta Was this translation helpful? Give feedback.
-
This version is about a year out of date. Please install a current version of Quarto first. Thanks! |
Beta Was this translation helpful? Give feedback.
-
Here is a fully reproducible example: Because Using a static document: |
Beta Was this translation helpful? Give feedback.
Here is a fully reproducible example:
Because
server: shiny
it means you need a running R server to run your Shiny App.Quarto Pub has no server ability, thus the code cell
context: server
is not executed leading to nothi…