Skip to content
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

Unable to render Altair plot using boxplot on repeat with mimetype #8016

Closed
1 of 2 tasks
SonQBChau opened this issue Oct 24, 2021 · 7 comments
Closed
1 of 2 tasks

Unable to render Altair plot using boxplot on repeat with mimetype #8016

SonQBChau opened this issue Oct 24, 2021 · 7 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug notebook-output verified Verification succeeded

Comments

@SonQBChau
Copy link

SonQBChau commented Oct 24, 2021

Applies To

  • Notebooks (.ipynb files)
  • Interactive Window and/or Cell Scripts (.py files with #%% markers)

What happened?

Issue description

Jupyter in VSCode is unable to render the Altair plot. This happens when using boxplot on repeat and set the renderer to mimetype

Steps to reproduce the issue

import altair as alt
from vega_datasets import data

# Show an image where the interactive plot is not supported
alt.renderers.enable('mimetype')

source = data.cars()

alt.Chart(source).mark_boxplot().encode(
    x='Origin',
    y=alt.Y(alt.repeat('column'), type='quantitative'),
).repeat(column=['Horsepower', 'Weight_in_lbs'])

What's the actual result?

TypeError: e.map is not a function

Additional details / screenshot

Screen Shot 2021-10-23 at 8 23 55 PM

Altair Package Version

4.1.0

VS Code Version

Version: 1.61.2 Commit: 6cba118ac49a1b88332f312a8f67186f7f3c1643 Date: 2021-10-19T15:03:09.437Z Electron: 13.5.1 Chrome: 91.0.4472.164 Node.js: 14.16.0 V8: 9.1.269.39-electron.0 OS: Darwin arm64 20.6.0

Jupyter Extension Version

v2021.9.1101343141

Jupyter logs

TypeError: e.map is not a function

Coding Language and Runtime Version

Python v3.9.7 64-bit

Language Extension Version (if applicable)

No response

Anaconda Version (if applicable)

No response

Running Jupyter locally or remotely?

Local

@SonQBChau SonQBChau added bug Issue identified by VS Code Team member as probable bug needs-triage labels Oct 24, 2021
@DonJayamanne
Copy link
Contributor

Thanks for reporting this issue, I can repro this at my end.

@DonJayamanne
Copy link
Contributor

Please use default as the mime renderer, (mime doesn't work in Jupyter lab either)
you can find more documentation here https://altair-viz.github.io/user_guide/custom_renderers.html

@SonQBChau
Copy link
Author

SonQBChau commented Oct 25, 2021

I tried the code on Jupyter lab and it displayed normally, so mine type works on Jupyter lab

Here is the env:

altair==4.1.0
altair-data-server==0.4.1
altair-saver==0.5.0
altair-viewer==0.3.0
jupyterlab==3.2.0

Screen Shot 2021-10-25 at 2 08 25 PM

@DonJayamanne
Copy link
Contributor

Interesting that option is not documented on that list https://altair-viz.github.io/user_guide/custom_renderers.html

@joelostblom
Copy link

@DonJayamanne
Copy link
Contributor

Thanks, will see what needs to be done at our end.
Hopefully just an update of the altair/vega or simiarl packages (used by us) should suffice.

@DonJayamanne
Copy link
Contributor

Fixed,

Testing instructions:

  • Install latest VS Code Insiders, Jupyter pre-release and Notebook renderers extension
  • Install the following python packages
    pip install altair, vega, vega-datasets
  • Run a cell in a notebook
import altair as alt
from vega_datasets import data

# Show an image where the interactive plot is not supported
alt.renderers.enable('mimetype')

source = data.cars()

alt.Chart(source).mark_boxplot().encode(
    x='Origin',
    y=alt.Y(alt.repeat('column'), type='quantitative'),
).repeat(column=['Horsepower', 'Weight_in_lbs'])
  • Plot should appear

@rzhao271 rzhao271 added the verified Verification succeeded label Sep 29, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 26, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug notebook-output verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

7 participants