You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

ggiraph绘图在Quarto(RStudio预览器)中无法渲染求助

解决Quarto中ggiraph交互式绘图空白的问题

Quarto渲染HTML时无法加载ggiraph绘图,核心原因是Quarto默认未正确识别ggiraph生成的交互式HTML输出,以下是具体解决步骤:

  • 在代码块中添加输出类型指定:在R代码块开头添加#| output: html,明确告诉Quarto要处理HTML格式的交互式输出,这是最关键的一步。
  • 更新依赖包:确保ggiraph和tidyverse是最新版本,避免版本兼容性问题,执行命令:
    update.packages(c("ggiraph", "tidyverse"))
    
  • 可选:调整girafe参数:如果仍有问题,可以尝试禁用工具栏,减少加载冲突:
    girafe(ggobj = graph, options = list(ggiraph_toolbar = FALSE))
    

修改后的完整Quarto代码示例:

---
title: "Interactive Iris Plot"
format: html
---

```{r}
#| output: 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)
内容的提问来源于stack exchange,提问作者Frank Morley
相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.02 15:35:43