Skip to content

Commit

Permalink
Improve troubleshooting docs regarding Vega-Lite 5 (#3074)
Browse files Browse the repository at this point in the history
* Make vegalite version number in DEFAULT_DISPLAY dynamic. Does not change the number now but makes it easier to upgrade in the future

* Update docs on display troubleshooting for Vega Lite 5

* Fix formatting
  • Loading branch information
binste authored Jun 15, 2023
1 parent f3938bf commit d957713
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 26 deletions.
4 changes: 2 additions & 2 deletions altair/vegalite/v5/display.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
ENTRY_POINT_GROUP = "altair.vegalite.v5.renderer" # type: str

# The display message when rendering fails
DEFAULT_DISPLAY = """\
<VegaLite 5 object>
DEFAULT_DISPLAY = f"""\
<VegaLite {VEGALITE_VERSION.split('.')[0]} object>
If you see this message, it means the renderer has not been properly enabled
for the frontend that you are using. For more information, see
Expand Down
39 changes: 15 additions & 24 deletions doc/user_guide/display_frontends.rst
Original file line number Diff line number Diff line change
Expand Up @@ -391,30 +391,25 @@ Troubleshooting in JupyterLab

.. _jupyterlab-vega-lite-4-object:

VegaLite 4 Object
^^^^^^^^^^^^^^^^^
VegaLite 4/5 Object
^^^^^^^^^^^^^^^^^^^
*If you are using the Jupyter notebook rather than JupyterLab, then refer to*
:ref:`notebook-vega-lite-4-object`

If you are using JupyterLab (not Jupyter notebook) and see the following output::

<VegaLite 4 object>

This means that you have enabled the ``mimetype`` renderer, but that your JupyterLab
frontend does not support the VegaLite 4 mimetype.
If you are using JupyterLab (not Jupyter notebook) and see an error message
mentioning either ``VegaLite 4 object`` or ``VegaLite 5 object``, then this means
that you have enabled the ``mimetype`` renderer, but that your JupyterLab
frontend does not support the VegaLite 4 or 5 mimetype.

The easiest solution is to use the default renderer::

alt.renderers.enable('default')

and rerun the cell with the chart.

If you would like to use the mimetype rendering with the JupyterLab frontend extension,
then make certain the extension is installed and enabled:

$ jupyter labextension install @jupyterlab/vega5-extension

and then restart your jupyter frontend.
If you would like to use the mimetype rendering with JupyterLab,
update JupyterLab to the newest version with ``pip install -U jupyterlab``
or ``conda update jupyterlab``.

.. _jupyterlab-vega-lite-3-object:

Expand Down Expand Up @@ -528,18 +523,14 @@ Troubleshooting in Notebooks

.. _notebook-vega-lite-4-object:

Notebook: VegaLite 4 object
^^^^^^^^^^^^^^^^^^^^^^^^^^^
Notebook: VegaLite 4/5 object
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
*If you are using JupyterLab rather than the Jupyter notebook, then refer to*
:ref:`jupyterlab-vega-lite-3-object`

If you are using Jupyter Notebook (not JupyterLab) and see the following output::
:ref:`jupyterlab-vega-lite-4-object`

<VegaLite 4 object>

This means that you have enabled the ``mimetype`` renderer.

The easiest solution is to use the default renderer::
If you are using Jupyter Notebook (not JupyterLab) and see an error message
mentioning either ``VegaLite 4 object`` or ``VegaLite 5 object``, then this means
that you have enabled the ``mimetype`` renderer. The easiest solution is to use the default renderer::

alt.renderers.enable('default')

Expand Down

0 comments on commit d957713

Please sign in to comment.