altair: Chart doesn't display, but shows the ascii representation
I’ve gone through the display troubleshooting and the only discrepancy I see is that I can’t get jupyter labextension list
to show @jupyterlab/vega3-extension
, though I note the comment in the Quick Start: Altair + JupyterLab jupyter labextension install @jupyterlab/vega3-extension # not needed for JupyterLab 0.32 or newer
and my version of JupyterLab is 0.32.1.
When I do the example:
import altair as alt
from vega_datasets import data
cars = data.cars()
alt.Chart(cars).mark_point().encode(
x='Horsepower',
y='Miles_per_Gallon',
color='Origin',
)
I see:
Chart({
data: Acceleration Cylinders Displacement Horsepower Miles_per_Gallon \
0 12.0 8 307.0 130.0 18.0
1 11.5 8 350.0 165.0 15.0
2 11.0 8 318.0 150.0 18.0
3 12.0 8 304.0 150.0 16.0
4 10.5 8 302.0 140.0 17.0
5 10.0 8 429.0 198.0 15.0
6 9.0 8 454.0 220.0 14.0
7 8.5 8 440.0 215.0 14.0
8 10.0 8 455.0 225.0 14.0
9 8.5 8 390.0 190.0 15.0
10 17.5 4 133.0 115.0 NaN
11 11.5 8 350.0 165.0 NaN
12 11.0 8 351.0 153.0 NaN
13 10.5 8 383.0 175.0 NaN
14 11.0 8 360.0 175.0 NaN
15 10.0 8 383.0 170.0 15.0
16 8.0 8 340.0 160.0 14.0
17 8.0 8 302.0 140.0 NaN
18 9.5 8 400.0 150.0 15.0
19 10.0 8 455.0 225.0 14.0
20 15.0 4 113.0 95.0 24.0
21 15.5 6 198.0 95.0 22.0
22 15.5 6 199.0 97.0 18.0
23 16.0 6 200.0 85.0 21.0
24 14.5 4 97.0 88.0 27.0
25 20.5 4 97.0 46.0 26.0
26 17.5 4 110.0 87.0 25.0
27 14.5 4 107.0 90.0 24.0
28 17.5 4 104.0 95.0 25.0
29 12.5 4 121.0 113.0 26.0
.. ... ... ... ... ...
376 18.6 4 112.0 88.0 27.0
377 18.0 4 112.0 88.0 34.0
378 16.2 4 112.0 85.0 31.0
379 16.0 4 135.0 84.0 29.0
380 18.0 4 151.0 90.0 27.0
381 16.4 4 140.0 92.0 24.0
382 20.5 4 151.0 NaN 23.0
383 15.3 4 105.0 74.0 36.0
384 18.2 4 91.0 68.0 37.0
385 17.6 4 91.0 68.0 31.0
386 14.7 4 105.0 63.0 38.0
387 17.3 4 98.0 70.0 36.0
388 14.5 4 120.0 88.0 36.0
389 14.5 4 107.0 75.0 36.0
390 16.9 4 108.0 70.0 34.0
391 15.0 4 91.0 67.0 38.0
392 15.7 4 91.0 67.0 32.0
393 16.2 4 91.0 67.0 38.0
394 16.4 6 181.0 110.0 25.0
395 17.0 6 262.0 85.0 38.0
396 14.5 4 156.0 92.0 26.0
397 14.7 6 232.0 112.0 22.0
398 13.9 4 144.0 96.0 32.0
399 13.0 4 135.0 84.0 36.0
400 17.3 4 151.0 90.0 27.0
401 15.6 4 140.0 86.0 27.0
402 24.6 4 97.0 52.0 44.0
403 11.6 4 135.0 84.0 32.0
404 18.6 4 120.0 79.0 28.0
405 19.4 4 119.0 82.0 31.0
Name Origin Weight_in_lbs Year
0 chevrolet chevelle malibu USA 3504 1970-01-01
1 buick skylark 320 USA 3693 1970-01-01
2 plymouth satellite USA 3436 1970-01-01
3 amc rebel sst USA 3433 1970-01-01
4 ford torino USA 3449 1970-01-01
5 ford galaxie 500 USA 4341 1970-01-01
6 chevrolet impala USA 4354 1970-01-01
7 plymouth fury iii USA 4312 1970-01-01
8 pontiac catalina USA 4425 1970-01-01
9 amc ambassador dpl USA 3850 1970-01-01
10 citroen ds-21 pallas Europe 3090 1970-01-01
11 chevrolet chevelle concours (sw) USA 4142 1970-01-01
12 ford torino (sw) USA 4034 1970-01-01
13 plymouth satellite (sw) USA 4166 1970-01-01
14 amc rebel sst (sw) USA 3850 1970-01-01
15 dodge challenger se USA 3563 1970-01-01
16 plymouth 'cuda 340 USA 3609 1970-01-01
17 ford mustang boss 302 USA 3353 1970-01-01
18 chevrolet monte carlo USA 3761 1970-01-01
19 buick estate wagon (sw) USA 3086 1970-01-01
20 toyota corona mark ii Japan 2372 1970-01-01
21 plymouth duster USA 2833 1970-01-01
22 amc hornet USA 2774 1970-01-01
23 ford maverick USA 2587 1970-01-01
24 datsun pl510 Japan 2130 1970-01-01
25 volkswagen 1131 deluxe sedan Europe 1835 1970-01-01
26 peugeot 504 Europe 2672 1970-01-01
27 audi 100 ls Europe 2430 1970-01-01
28 saab 99e Europe 2375 1970-01-01
29 bmw 2002 Europe 2234 1970-01-01
.. ... ... ... ...
376 chevrolet cavalier wagon USA 2640 1982-01-01
377 chevrolet cavalier 2-door USA 2395 1982-01-01
378 pontiac j2000 se hatchback USA 2575 1982-01-01
379 dodge aries se USA 2525 1982-01-01
380 pontiac phoenix USA 2735 1982-01-01
381 ford fairmont futura USA 2865 1982-01-01
382 amc concord dl USA 3035 1982-01-01
383 volkswagen rabbit l Europe 1980 1982-01-01
384 mazda glc custom l Japan 2025 1982-01-01
385 mazda glc custom Japan 1970 1982-01-01
386 plymouth horizon miser USA 2125 1982-01-01
387 mercury lynx l USA 2125 1982-01-01
388 nissan stanza xe Japan 2160 1982-01-01
389 honda Accelerationord Japan 2205 1982-01-01
390 toyota corolla Japan 2245 1982-01-01
391 honda civic Japan 1965 1982-01-01
392 honda civic (auto) Japan 1965 1982-01-01
393 datsun 310 gx Japan 1995 1982-01-01
394 buick century limited USA 2945 1982-01-01
395 oldsmobile cutlass ciera (diesel) USA 3015 1982-01-01
396 chrysler lebaron medallion USA 2585 1982-01-01
397 ford granada l USA 2835 1982-01-01
398 toyota celica gt Japan 2665 1982-01-01
399 dodge charger 2.2 USA 2370 1982-01-01
400 chevrolet camaro USA 2950 1982-01-01
401 ford mustang gl USA 2790 1982-01-01
402 vw pickup Europe 2130 1982-01-01
403 dodge rampage USA 2295 1982-01-01
404 ford ranger USA 2625 1982-01-01
405 chevy s-10 USA 2720 1982-01-01
[406 rows x 9 columns],
encoding: EncodingWithFacet({
color: Color({
shorthand: 'Origin'
}),
x: X({
shorthand: 'Horsepower'
}),
y: Y({
shorthand: 'Miles_per_Gallon'
})
}),
mark: 'point'
})
And similarly for the simpler version:
alt.Chart('nonexistent_file.csv').mark_line().encode(
x='x:Q',
y='y:Q',
)
I get
Chart({
data: 'nonexistent_file.csv',
encoding: EncodingWithFacet({
x: X({
shorthand: 'x:Q'
}),
y: Y({
shorthand: 'y:Q'
})
}),
mark: 'line'
})
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 17 (9 by maintainers)
THANKS! For the debugging and the super speediness!
Congratulations on hitting the deepest, darkest corner case in the entire Jupyter ecosystem