Renderplotly working in Rstudio but not in vscode

When I try this code in Rstudio, it works perfectly fine, but when i try this in vscode, I am not getting the second plot. Please find the code and screenshots below.

---
title: "Flexdashboard with Individual Sidebar Inputs for Each Graph"
output: 
  flexdashboard::flex_dashboard:
    orientation: columns
    vertical_layout: fill
runtime: shiny
---

```{r setup, include=FALSE}
library(flexdashboard)
library(plotly)
library(shiny)

Column {data-width=650}

Chart A


plot_ly(data = iris, x = ~Sepal.Length, y = ~Petal.Length,
color= ~Species, type = "scatter", mode = "markers")




Column {data-width=350}

Chart B

# Sidebar input for graph 2
selectInput("var2",
            label = "Select Variable 2:",
            choices = c("mpg", "disp", "hp"),
            selected = "mpg")
# Plotly chart for Tab 2
renderPlotly({
plot_ly(data = mtcars, x = ~mpg, y = ~get(input$var2), color = ~cyl, type = "scatter", mode = "markers")
})

[This is from Rstudio]

[This is the screenshot of rendered HTML from vscode]

As you can see I can't get the second plot in the rendered HTML from vscode. Please help me in resolving this issue. I need to use vscode to execute my upcoming dashboards.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.