0

I have made a plot with an interactive annotation; this works in RStudio in the viewer tab when I run this code:

library(ggiraph)
library(tidyverse)

data(iris)

graph <- iris %>%
  ggplot(aes(x = Sepal.Length, y = Sepal.Width)) +
  geom_point() +
  annotate_interactive("text", x = 7, y = 4, 
                       label = "1.",
                       fontface = "bold",
                       tooltip = "a test") 

girafe(ggobj = graph)

RStudio viewer tab:

enter image description here

However, when I try to write this onto a Quarto document and render in Rstudio, the graph comes back as a blank space. It doesn't load. The output is html.

library(ggiraph)
library(tidyverse)

data(iris)

graph <- iris %>%
  ggplot(aes(x = Sepal.Length, y = Sepal.Width)) +
  geom_point() +
  annotate_interactive("text", x = 7, y = 4, 
                       label = "1.",
                       fontface = "bold",
                       tooltip = "a test") 

girafe(ggobj = graph)

I would have expected this to work within Quarto, but I might be missing something. Many thanks.

jrcalabrese
  • 2,184
  • 3
  • 10
  • 30

1 Answers1

0

I have solved my own question. Orginally I had written near the top of the file cache = TRUE. I replaced this with echo = TRUE. Now it works

```{r setup, include = FALSE}
knitr::opts_chunk$set(cache = TRUE)
```
```{r setup, include = FALSE}
knitr::opts_chunk$set(echo = TRUE)
```