解決Altair 在juypter notebook 中安裝後,圖表不顯示問題

Why isn’t my plot displaying in the Jupyter Notebook?

官網:https://altair-viz.github.io/faq.htmlhtml

The most common cause of a non-displaying plot in the Jupyter Notebook is incorrect configuration of the ipyvega jupyter extension, which is what recognizes an Altair object and automatically renders the plot with the Vega-Lite library.git

If you install altair using conda, this nbextension setup step should be taken care of automatically. If you install altair using pip, there is an extra step to enable this extension; see the discussion at Installation.github

If this still is not addressing the problem, it may be due to having multiple incompatible versions of altair and vega on your system. Try updating both packages using, e.g. conda update altair vega or pip install altair vega --update.this

If this still doesn’t work, please open an issue in the Altair’s GitHub Issue Tracker, and we will do our best to help. In the meantime, other means of displaying Altair plots are listed in Displaying and Saving Altair Visualizations.spa

 

考慮安裝命令:(保證如下三個命令都在Prompt黑框端有效安裝) code

Altair can be installed via the Python Package Index with the following:htm

$ pip install altair
$ pip install --upgrade notebook
$ jupyter nbextension install --sys-prefix --py vega

The additional commands serve to set-up the ipyvega module to automatically render Altair plots within the Jupyter notebook (see Displaying Plots in Jupyter Notebook) Alternatively, you can install with conda, which handles the Jupyter notebook setup within the single install command:ip

$ conda install altair --channel conda-forge
相關文章
相關標籤/搜索