Version 5.2.0
What's Changed
- Update Vega-Lite from version 5.15.1 to version 5.16.3; see Vega-Lite Release Notes.
Enhancements
-
Support offline HTML export using vl-convert (#3251)
You now can use:
chart.save('chart.html', inline=True)
To create an HTML file with inline JavaScript dependencies. This enhancements takes advantage of HTML bundling support in
vl-convert
to replace the dependency onaltair_viewer
. Vega-Altair 5.2.0 expectsvl-convert-python
version 1.1.0 or higher for this enhancement.
-
Support saving charts as PDF files using the vl-convert export engine (#3244)
You now can use:
chart.save('chart.pdf')
To create an PDF representation of your chart. This enhancements takes advantage of PDF support in
vl-convert
to replace the dependency onaltair_saver
. Vega-Altair 5.2.0 expectsvl-convert-python
version 1.1.0 or higher for this enhancement.
-
Support converting charts to sharable Vega editor URLs with chart.to_url() (#3252)
You now can use:
chart.to_url()
To generate a Vega editor URL that opens the chart's specification in the online Vega editor. This enhancements takes advantage of lz-string URL-compatible compression in
vl-convert
. Vega-Altair 5.2.0 expectsvl-convert-python
version 1.1.0 or higher for this enhancement.Example:
import altair as alt from vega_datasets import data chart = alt.Chart(data.cars.url).mark_point().encode( x='Horsepower:Q', y='Miles_per_Gallon:Q', color='Origin:N' ) print(chart.to_url())
-
Pass
format_locale
andtime_format_locale
through to vl-convert to support locales in static image export (#3274)The preferred format of numbers, dates, and currencies varies by language and locale. Vega-Altair takes advantage of D3’s localization support to make it easy to configure the locale for your chart using the global
alt.renderers.set_embed_options
function. Vega-Altair 5.2.0 expectsvl-convert-python
version 1.1.0 or higher for this enhancement.See https://altair-viz.github.io/user_guide/customization.html#localization for more info (including the note with a caveat!).
-
Vega-Altair is now a typed package, with type annotations for all public functions and classes and some of the internal code
See #2951 for a full summary how we have implemented these. Type hints can help IDEs to provide a better development experience as well as static type checkers to catch potential errors before they appear at runtime.
Maintenance
- Vega-Altair now uses ruff for maintaining code quality & consistency (#3243)
- Vega-Altair is tested against Python 3.12 (#3235)
Bug Fixes
- None
Backward-Incompatible Changes
- None
New Contributors
- @ChiaLingWeng made their first contribution in #3218
Release Notes by Pull Request
Click to view all 31 PRs merged in this release
- Perform minor consistency cleanup by @joelostblom in #3215
- [Doc] Add integers to four digit year format example by @ChiaLingWeng in #3218
- Maint: Do not pass literal json to read_json in test by @binste in #3221
- Do not display search keyboard shortcut on home page by @joelostblom in #3220
- [Doc] Add Label Position Based on Condition Example by @ChiaLingWeng in #3226
- [Doc] Update UserGuide: Add Rotate Axis, Sort Legend Example, Citing Section by @ChiaLingWeng in #3217
- [Doc] Add Show Image Marks With Selection/Show Local Images Examples by @ChiaLingWeng in #3219
- [Doc] Add Reverse Scale and Update Example for Consistency by @ChiaLingWeng in #3228
- Correct the method-based syntax for a few more gallery examples by @joelostblom in #3005
- doc: update pandas to smallcase p by @mattijn in #3232
- Type hint api.py by @binste in #3143
- maint: change to ruff for formatting by @mattijn in #3243
- maint: GitHub action include
python-version
3.12 by @mattijn in #3235 - Support saving to PDF with VlConvert 1.0 by @jonmmease in #3244
- Support converting a Chart to a Vega editor URL by @jonmmease in #3252
- Type hint utils/save.py and utils/mimebundle.py by @binste in #3248
- docs: add range bar chart by @mattijn in #3250
- doc: barchart highlighting values beyond a single threshold by @mattijn in #3249
- Update image export error message with PDF format by @jonmmease in #3255
- Use vl-convert for offline html export by @jonmmease in #3251
- doc: add example interactive aggregation by @mattijn in #3260
- [Doc] Add Arrow Vector Example by @ChiaLingWeng in #3236
- [Doc] Add scatter plot with shaded area example by @ChiaLingWeng in #3256
- Make facet error more informative by @joelostblom in #3264
- Type hints: Infer types from vegalite schema for autogenerated code by @binste in #3208
- Fix broken JupyterWidget chart by pinning Vega by @jonmmease in #3269
- Type hints: Finish type hints and mark package as typed by @binste in #3272
- Update to Vega-Lite 5.16.3 by @jonmmease in #3273
- Pass locale info through to vl-convert, default to display embed options when not set by @jonmmease in #3274
- doc: add example, interval selection on a map by @mattijn in #3275
- doc: maintain colors by @mattijn in #3276
Full Changelog: v5.1.2...v5.2.0