Plotly友好型,Jupyter Notebook HTML导出器。
项目描述
Plotly友好型,Jupyter Notebook HTML导出器。
NBConvert 是一个将 Jupyter Notebooks 转换为其他格式(pdf、html等)的模块。它提供了 HTMLExporter,用于将 Jupyter Notebooks 转换为 html。
PlotlyHTMLExporter 是从 HTMLExporter 衍生出的自定义导出器。它清理输出单元格中的 JS/HTML,但保留受信任的 plotly.js 输出完整,从而允许在生成的 html 中渲染 plotly 图表。
安装
使用 pip
$ pip install plotlyhtmlexporter
从源
$ git clone https://github.com/plotly/plotlyhtmlexporter $ cd plotlyhtmlexporter $ python setup.py install
使用方法
从命令行(使用NBConvert)
$ jupyter nbconvert --to plotlyhtml mynotebook.ipynb
从Python解释器
>>> import nbformat >>> nb = nbformat.read('mynotebook.ipynb', 4) >>> from plotlyhtmlexporter import PlotlyHTMLExporter >>> exp = PlotlyHTMLExporter() >>> body, resources = exp.from_notebook_node(nb)
许可证:MIT