When I try to display a chart from plotly on a new page inside flexdashboard it does not display.
Why is that happening?
Below there is an example.
It is displayed only in the first page but not on the second one.
In the example I put a dot after each r chunk in order to see also the code for the pages in flexdashboard .
title: "Test"
output:
flexdashboard::flex_dashboard
knitr::opts_chunk$set(
echo = FALSE,
message = FALSE,
warning = FALSE
)
library(plotly)
``` .
page 1
===
Column
-------------------------------------
### Chart 1
```{r chart 1}
density <- state.x77[, "Population"] / state.x77[, "Area"]
g <- list(
scope = 'usa',
projection = list(type = 'albers usa'),
lakecolor = toRGB('white')
)
plot_geo() %>%
add_trace(
z = ~density, text = state.name, span = I(0),
locations = state.abb, locationmode = 'USA-states'
) %>%
layout(geo = g)
``` .
Column
-------------------------------------
### Chart 2
```{r}
plot_geo() %>%
add_trace(
z = ~density, text = state.name, span = I(0),
locations = state.abb, locationmode = 'USA-states'
) %>%
layout(geo = g)
``` .
page 2
===
```{r }
plot_geo() %>%
add_trace(
z = ~density, text = state.name, span = I(0),
locations = state.abb, locationmode = 'USA-states'
) %>%
layout(geo = g)
``` .