-
Notifications
You must be signed in to change notification settings - Fork 795
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Axis name breaks chart on HTML export but not in notebook #993
Comments
It might be that you are using a frontend renderer (e.g. JupyterLab/Jupyter notebook) that has an older version of Vega-Lite, which doesn't support What happens if you change |
If you open the javascript console, I suspect you'll see an error along the lines of
if so, this is the cause of the problem. |
@jakevdp The change you proposed fixes the export! Also, in the HTML generated by Altair's
When I change this manually to
things work with the original code I posted (with the Please note that the chart renders well in the notebook, also with the Also, where can I update my Vega lite version? I just conda-installed everything, and I'm not really sure which installer installed which version of vega-lite, to be honest. A
|
Great!
As I mentioned above, the version of Vega-Lite used by your frontend is not controlled by Altair, but by the frontend renderer.
If you're using Jupyter Notebook (not JupyterLab), the version of Vega-Lite used to render plots is defined in the vega extension, namely in https://github.com/vega/ipyvega/blob/master/package.json via https://github.com/vega/vega-embed/blob/master/package.json. I wish that were easier to access from Python; I've opened an issue regarding that: vega/ipyvega#97 If you update the vega package from pip, it should use the most recent vega-lite version. For HTML export, the vega-lite version is defined by Altair itself, namely here: https://github.com/altair-viz/altair/blob/master/altair/vegalite/v2/schema/__init__.py#L4 >>> import altair
>>> altair.VEGALITE_VERSION
'2.5.2' |
I have built a chart where renaming an axis breaks the HTML export of the chart, but not the display in a Jupyter notebook. When I open the exported HTML file, the error message from the error handler is displayed. Strangely, when I copy the pure chart dictionary from the HTML into the Vega Lite web editor, things work and the chart displays fine.
Apologies for the complex example. I could not reproduce the error with a simpler one, and I need the data generator because I cannot share my original data.
This is the version, where the output (
test.html
) is broken, while the chart displays fine in a notebook:The export works again when I replace
alt.Y('mean:Q', title='RENAMED')
in themark_line()
part with'mean:Q'
, not renaming the axis.I'm working on fresh (yesterday) Conda install of Altair.
The text was updated successfully, but these errors were encountered: