运行 jupyterlab / jupyternotebooks 中的 highcharter

run highcharter in jupyterlab / jupyternotebooks

我正在尝试在 jupyterlab

中呈现一些 highcharter 图表
data(diamonds, economics_long, mpg, package = "ggplot2")
library(dplyr)
library(highcharter)
hchart(mpg, "scatter", hcaes(x = displ, y = hwy, group = class))

要使 plotlywrapper 正常工作,您需要安装扩展程序。我可以想象必须为 highcharter 构建类似的东西吗?

错误信息:

HTML widgets cannot be represented in plain text (need html)

https://blog.ouseful.info/2018/04/26/r-htmlwidgets-in-jupyter-notebooks/

data(diamonds, economics_long, mpg, package = "ggplot2")
library(dplyr)
library(highcharter)
x=hchart(mpg, "scatter", hcaes(x = displ, y = hwy, group = class)) %>%
hc_size(width=800, height = 400)
saveWidget(x, 'demox.html', selfcontained = FALSE)
display_html('<iframe src="demox.html", width = 900, height = 500 ></iframe>')