Altair

Latest version: v5.3.0

Safety actively analyzes 621920 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 1 of 5

5.3.0

<!-- Release notes generated using configuration in .github/release.yml at v5.3.0 -->

What's Changed
- Update Vega-Lite from version 5.16.3 to version 5.17.0; see [Vega-Lite Release Notes](https://github.com/vega/vega-lite/releases)

Enhancements
- Add `"jupyter"` renderer which uses JupyterChart for rendering (3283). See [Displaying Altair Charts](https://altair-viz.github.io/user_guide/display_frontends.html#altair-s-renderer-framework) for more information.
- Add integration of VegaFusion and JupyterChart to support data transformations in the Python kernel for interactive charts (3281). See [VegaFusion Data Transformer](https://altair-viz.github.io/user_guide/large_datasets.html#vegafusion-data-transformer) for more information.
- Add `embed_options` argument to JupyterChart to allow customization of Vega Embed options (3304)
- Add offline support for JupyterChart and the new `"jupyter"` renderer. See [JupyterChart - Offline Usage](https://altair-viz.github.io/user_guide/jupyter_chart.html#offline-usage) for more information.
- Add `"browser"` renderer to support displaying Altair charts in an external web browser. See [Browser Renderer](https://altair-viz.github.io/user_guide/display_frontends.html#browser-renderer) for more information (3379).
- Add a [new section to documentation](https://altair-viz.github.io/user_guide/display_frontends.html#dashboards) on dashboards which have support for Altair (3299)
- Support restrictive FIPS-compliant environment (3291)
- Support opening charts in the Vega editor with `chart.open_editor()` (3358)
- Simplify type-hints to improve the readability of the function signature and docstring (3307)
- Support installation of all optional dependencies via `python -m pip install altair[all]` and `conda install altair-all -c conda-forge` (3354)
- Add privacy friendly web-analytics for the documentation (3350)
- Additional gallery examples and documentation clarifications (3233, 3266, 3276, 3282, 3298, 3299, 3323, 3334, 3324, 3340, 3350, 3353, 3357, 3362, 3363)

Bug Fixes
- Fix error when `embed_options` are `None` (3376)
- Fix type hints for libraries such as Polars where Altair uses the dataframe interchange protocol (3297)
- Fix anywidget deprecation warning (3364)
- Fix handling of Date32 columns in arrow tables and Polars DataFrames (3377)

Backward-Incompatible Changes
- Changed hash function from `md5` to a truncated `sha256` non-cryptograhic hash (3291)
- Updated `chart.show()` method to invoke the active renderer rather than depend on `altair_saver` (Which was never updated for use with Altair 5) (3379).


Release notes by pull requests
* perf: Improve performance of `Chart.from_dict` by RobinL in https://github.com/altair-viz/altair/pull/3383
* feature: Add browser renderer to open charts in external browser and update chart.show() to display chart by jonmmease in https://github.com/altair-viz/altair/pull/3379
* fix: Don't error when embed_options are None by jonmmease in https://github.com/altair-viz/altair/pull/3376
* fix: Handle Date32 columns in Arrow tables and Polars DataFrames by jonmmease in https://github.com/altair-viz/altair/pull/3377
* fix: Support falling back to pandas when pyarrow is installed but too old by jonmmease in https://github.com/altair-viz/altair/pull/3387
* docs: Remove release notes and fully capture them in GitHub Releases by binste in https://github.com/altair-viz/altair/pull/3380
* Update save.py to use utf-8 instead of None per default by franzhaas in https://github.com/altair-viz/altair/pull/3278
* Consolidate governance documents in Vega Organization by domoritz in https://github.com/altair-viz/altair/pull/3277
* doc: histogram with gradient color by mattijn in https://github.com/altair-viz/altair/pull/3282
* Update for FIPS Compliance by ccravens in https://github.com/altair-viz/altair/pull/3291
* Docs: Fix link to project governance docs by binste in https://github.com/altair-viz/altair/pull/3298
* Fix type checker errors for libraries such as Polars where Altair uses dataframe interchange protocol by binste in https://github.com/altair-viz/altair/pull/3297
* Integrate VegaFusion into JupyterChart by jonmmease in https://github.com/altair-viz/altair/pull/3281
* Add "jupyter" renderer based on JupyterChart by jonmmease in https://github.com/altair-viz/altair/pull/3283
* Docs: Add section on displaying Altair charts in dashboards by binste in https://github.com/altair-viz/altair/pull/3299
* Validate version of vegafusion-python-embed by jonmmease in https://github.com/altair-viz/altair/pull/3303
* Add embed_options to JupyterChart and pass them through in "jupyter" renderer by jonmmease in https://github.com/altair-viz/altair/pull/3304
* Add offline support to JupyterChart and "jupyter" renderer by jonmmease in https://github.com/altair-viz/altair/pull/3305
* Type hints: Simplify to improve user experiences by binste in https://github.com/altair-viz/altair/pull/3307
* Adding missing interpolation methods to Line example by thomascamminady in https://github.com/altair-viz/altair/pull/3323
* Docs: Link to new section on Altair in Plotly docs by binste in https://github.com/altair-viz/altair/pull/3324
* Docs: Mark completed items in roadmap by binste in https://github.com/altair-viz/altair/pull/3326
* Docs: Mention Marimo in Dashboards section by binste in https://github.com/altair-viz/altair/pull/3334
* Relax type hint for 'indent' in to_json method by binste in https://github.com/altair-viz/altair/pull/3342
* MAINT: Reformat codebase with new style of ruff 0.3.0 by binste in https://github.com/altair-viz/altair/pull/3345
* Docs: Add another version of the 'Multiline Tooltip' exmaple which uses the standard tooltip by binste in https://github.com/altair-viz/altair/pull/3340
* Docs: Add privacy-friendly web analytics with plausible by binste in https://github.com/altair-viz/altair/pull/3346
* Docs: Modifying scale of "multiple interactions" example and adding legend adjustments by d-trigo in https://github.com/altair-viz/altair/pull/3350
* Add example of how to update titles based on a selection parameters by joelostblom in https://github.com/altair-viz/altair/pull/3353
* Add `all` dependency group by jonmmease in https://github.com/altair-viz/altair/pull/3354
* Add timeseries filtering example to illustrate subsetting of columns from selector values by joelostblom in https://github.com/altair-viz/altair/pull/3357
* Fix anywidget deprecation warning by jonmmease in https://github.com/altair-viz/altair/pull/3364
* Clarifications to the interactive docs by joelostblom in https://github.com/altair-viz/altair/pull/3362
* Open charts in the default browser with `open_editor` method by joelostblom in https://github.com/altair-viz/altair/pull/3358
* Change "mouse" to "pointer" everywhere by joelostblom in https://github.com/altair-viz/altair/pull/3363
* doc: update numpy-tooltip-images.rst by mattijn in https://github.com/altair-viz/altair/pull/3233
* Change a couple of more additional occurences of pointer over by joelostblom in https://github.com/altair-viz/altair/pull/3368
* [Doc] Fix Chart and MarkDef language by ChiaLingWeng in https://github.com/altair-viz/altair/pull/3266
* Add remaining changelog entries for 5.3 by joelostblom in https://github.com/altair-viz/altair/pull/3369
* Upgrade to Vega-Lite 5.17.0 by binste in https://github.com/altair-viz/altair/pull/3367
* Add a few 5.3 changelog entries by jonmmease in https://github.com/altair-viz/altair/pull/3372
* Add note about conda "all" installation and how to install without optional dependencies by joelostblom in https://github.com/altair-viz/altair/pull/3373
* Update README badges to reflect updated tool chain by mattijn in https://github.com/altair-viz/altair/pull/3374
* chore: Add templates for PRs and automated release notes by joelostblom in https://github.com/altair-viz/altair/pull/3381

New Contributors
* franzhaas made their first contribution in https://github.com/altair-viz/altair/pull/3278
* ccravens made their first contribution in https://github.com/altair-viz/altair/pull/3291
* thomascamminady made their first contribution in https://github.com/altair-viz/altair/pull/3323
* d-trigo made their first contribution in https://github.com/altair-viz/altair/pull/3350
* RobinL made their first contribution in https://github.com/altair-viz/altair/pull/3383

**Full Changelog**: https://github.com/altair-viz/altair/compare/v5.2.0...v5.3.0

5.2.0

What's Changed
* Update Vega-Lite from version 5.15.1 to version 5.16.3; see [Vega-Lite Release Notes](https://github.com/vega/vega-lite/releases).

Enhancements

1. 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 on `altair_viewer`. Vega-Altair 5.2.0 expects `vl-convert-python` [version 1.1.0](https://pypi.org/project/vl-convert-python) or higher for this enhancement.
***
2. 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 on `altair_saver`. Vega-Altair 5.2.0 expects `vl-convert-python` [version 1.1.0](https://pypi.org/project/vl-convert-python) or higher for this enhancement.

***
3. 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 expects `vl-convert-python` [version 1.1.0](https://pypi.org/project/vl-convert-python) or higher for this enhancement.

Example:
python
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())


[https://vega.github.io/editor/#/url/vega-lite/N4Igxg9gdgZglgcxALlANzgUwO4tJKAFzigFcJSBnAdTgBNCALFAZgAY2AacaYsiygAlMiRoVYcAvpO50AhoTl4QpAE4AbFCDGEADpWQB6Q2DpQAdACtKdTOrhpV5qJkKGougLaG0mBHIBaeUVKV0oAATQARnMAJgBOczZDYLkTOVVKK0poEBkQTwyAa2VCAE9dTC1dCBJxfMwoSDoSJFQedQhVZXg7Oi0AeVVEEhBucsqtKAhPEjlNfIAPHqx1fuQQQS7QmuxMbvGKqo2AR1I5IjhFYl887jKVvq0AWTh1TEoAfUrVT4BxeadKBjEATY4gM4XYjXBxVaTcAAklDAjEwhS0On0Rh8fjk5gQV0YpAARuY4BBDMjUYUcf4AvZCJgfABWcxRABs5hY2VykiAA](https://vega.github.io/editor/#/url/vega-lite/N4Igxg9gdgZglgcxALlANzgUwO4tJKAFzigFcJSBnAdTgBNCALFAZgAY2AacaYsiygAlMiRoVYcAvpO50AhoTl4QpAE4AbFCDGEADpWQB6Q2DpQAdACtKdTOrhpV5qJkKGougLaG0mBHIBaeUVKV0oAATQARnMAJgBOczZDYLkTOVVKK0poEBkQTwyAa2VCAE9dTC1dCBJxfMwoSDoSJFQedQhVZXg7Oi0AeVVEEhBucsqtKAhPEjlNfIAPHqx1fuQQQS7QmuxMbvGKqo2AR1I5IjhFYl887jKVvq0AWTh1TEoAfUrVT4BxeadKBjEATY4gM4XYjXBxVaTcAAklDAjEwhS0On0Rh8fjk5gQV0YpAARuY4BBDMjUYUcf4AvZCJgfABWcxRABs5hY2VykiAA)

***
4. Pass `format_locale` and `time_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](https://d3-wiki.readthedocs.io/zh-cn/master/Localization/) 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 expects `vl-convert-python` [version 1.1.0](https://pypi.org/project/vl-convert-python) 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!).
***
5. Vega-Altair is now a typed package, with type annotations for all public functions and classes and some of the internal code

See https://github.com/altair-viz/altair/issues/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

Release Notes by Pull Request
* Perform minor consistency cleanup by joelostblom in https://github.com/altair-viz/altair/pull/3215
* [Doc] Add integers to four digit year format example by ChiaLingWeng in https://github.com/altair-viz/altair/pull/3218
* Maint: Do not pass literal json to read_json in test by binste in https://github.com/altair-viz/altair/pull/3221
* Do not display search keyboard shortcut on home page by joelostblom in https://github.com/altair-viz/altair/pull/3220
* [Doc] Add Label Position Based on Condition Example by ChiaLingWeng in https://github.com/altair-viz/altair/pull/3226
* [Doc] Update UserGuide: Add Rotate Axis, Sort Legend Example, Citing Section by ChiaLingWeng in https://github.com/altair-viz/altair/pull/3217
* [Doc] Add Show Image Marks With Selection/Show Local Images Examples by ChiaLingWeng in https://github.com/altair-viz/altair/pull/3219
* [Doc] Add Reverse Scale and Update Example for Consistency by ChiaLingWeng in https://github.com/altair-viz/altair/pull/3228
* Correct the method-based syntax for a few more gallery examples by joelostblom in https://github.com/altair-viz/altair/pull/3005
* doc: update pandas to smallcase p by mattijn in https://github.com/altair-viz/altair/pull/3232
* Type hint api.py by binste in https://github.com/altair-viz/altair/pull/3143
* maint: change to ruff for formatting by mattijn in https://github.com/altair-viz/altair/pull/3243
* maint: GitHub action include `python-version` 3.12 by mattijn in https://github.com/altair-viz/altair/pull/3235
* Support saving to PDF with VlConvert 1.0 by jonmmease in https://github.com/altair-viz/altair/pull/3244
* Support converting a Chart to a Vega editor URL by jonmmease in https://github.com/altair-viz/altair/pull/3252
* Type hint utils/save.py and utils/mimebundle.py by binste in https://github.com/altair-viz/altair/pull/3248
* docs: add range bar chart by mattijn in https://github.com/altair-viz/altair/pull/3250
* doc: barchart highlighting values beyond a single threshold by mattijn in https://github.com/altair-viz/altair/pull/3249
* Update image export error message with PDF format by jonmmease in https://github.com/altair-viz/altair/pull/3255
* Use vl-convert for offline html export by jonmmease in https://github.com/altair-viz/altair/pull/3251
* doc: add example interactive aggregation by mattijn in https://github.com/altair-viz/altair/pull/3260
* [Doc] Add Arrow Vector Example by ChiaLingWeng in https://github.com/altair-viz/altair/pull/3236
* [Doc] Add scatter plot with shaded area example by ChiaLingWeng in https://github.com/altair-viz/altair/pull/3256
* Make facet error more informative by joelostblom in https://github.com/altair-viz/altair/pull/3264
* Type hints: Infer types from vegalite schema for autogenerated code by binste in https://github.com/altair-viz/altair/pull/3208
* Fix broken JupyterWidget chart by pinning Vega by jonmmease in https://github.com/altair-viz/altair/pull/3269
* Type hints: Finish type hints and mark package as typed by binste in https://github.com/altair-viz/altair/pull/3272
* Update to Vega-Lite 5.16.3 by jonmmease in https://github.com/altair-viz/altair/pull/3273
* Pass locale info through to vl-convert, default to display embed options when not set by jonmmease in https://github.com/altair-viz/altair/pull/3274
* doc: add example, interval selection on a map by mattijn in https://github.com/altair-viz/altair/pull/3275
* doc: maintain colors by mattijn in https://github.com/altair-viz/altair/pull/3276

New Contributors
* ChiaLingWeng made their first contribution in https://github.com/altair-viz/altair/pull/3218

**Full Changelog**: https://github.com/altair-viz/altair/compare/v5.1.2...v5.2.0

5.1.2

What's changed

- Update Vega-Lite from version 5.14.1 to version 5.15.1; see [Vega-Lite Release Notes](https://github.com/vega/vega-lite/releases/tag/v5.15.1).
- Use Facet/Trellis/Repeat consistently in the documentation by NickCrews in 3180

Bug Fixes

- Remove usage of deprecated Pandas parameter ``convert_dtypes`` by binste in 3191
- Fix encoding type inference for boolean columns when pyarrow is installed by jonmmease in 3210

**Full Changelog**: https://github.com/altair-viz/altair/compare/v5.1.1...v5.1.2

5.1.1

What's Changed
* Fix doctest and run doctests in altair module by jonmmease in https://github.com/altair-viz/altair/pull/3175
* infer dtype pandas fallback by jonmmease in https://github.com/altair-viz/altair/pull/3179


**Full Changelog**: https://github.com/altair-viz/altair/compare/v5.1.0...v5.1.1

5.1.0

What's Changed
* Update Vega-Lite from version 5.8.0 to version 5.14.1; see [Vega-Lite Release Notes](https://github.com/vega/vega-lite/releases).

Enhancements
1. The `chart.transformed_data()` method was added to extract transformed chart data

For example when having an Altair chart including aggregations:
python
import altair as alt
from vega_datasets import data

cars = data.cars.url
chart = alt.Chart(cars).mark_bar().encode(
y='Cylinders:O',
x='mean_acc:Q'
).transform_aggregate(
mean_acc='mean(Acceleration)',
groupby=["Cylinders"]
)
chart

![image](https://github.com/altair-viz/altair/assets/5186265/d2b45c35-fbf4-4ae0-9b1f-08134efc8922)
Its now possible to call the `chart.transformed_data` method to extract a pandas DataFrame containing the transformed data.
python
chart.transformed_data()

![image](https://github.com/altair-viz/altair/assets/5186265/35891190-18bd-4910-a116-5dbc36af9482)
This method is dependent on VegaFusion with the embed extras enabled.
***
2. Introduction of a new data transformer named `vegafusion`

VegaFusion is an external project that provides efficient Rust implementations of most of Altair's data transformations. Using VegaFusion as Data Transformer it can overcome the Altair MaxRowsError by performing data-intensive aggregations in Python and pruning unused columns from the source dataset.

The data transformer can be enabled as such:
python
import altair as alt
alt.data_transformers.enable("vegafusion") default is "default"


> cmd
> DataTransformerRegistry.enable('vegafusion')
>

And one can now visualize a very large DataFrame as histogram where the binning is done within VegaFusion:
python
import pandas as pd
import altair as alt

prepare dataframe with 1 million rows
flights = pd.read_parquet(
"https://vegafusion-datasets.s3.amazonaws.com/vega/flights_1m.parquet"
)

delay_hist = alt.Chart(flights).mark_bar(tooltip=True).encode(
alt.X("delay", bin=alt.Bin(maxbins=30)),
alt.Y("count()")
)
delay_hist

![image](https://github.com/altair-viz/altair/assets/5186265/773b81ab-280d-4164-9c32-99d2b9567e12)
When the `vegafusion` data transformer is active, data transformations will be pre-evaluated when displaying, saving and converting charts as dictionary or JSON.

See a detailed overview on the [VegaFusion Data Transformer](https://altair-viz.github.io/user_guide/large_datasets.html#vegafusion-data-transformer) in the documentation.

***
3. A `JupyterChart` class was added to support accessing params and selections from Python

The `JupyterChart` class makes it possible to update charts after they have been displayed and access the state of interactions from Python.

For example when having an Altair chart including a selection interval as brush:
python
import altair as alt
from vega_datasets import data

source = data.cars()
brush = alt.selection_interval(name="interval", value={"x": [80, 160], "y": [15, 30]})

chart = alt.Chart(source).mark_point().encode(
x='Horsepower:Q',
y='Miles_per_Gallon:Q',
color=alt.condition(brush, 'Cylinders:O', alt.value('grey')),
).add_params(brush)

jchart = alt.JupyterChart(chart)
jchart

![image](https://github.com/altair-viz/altair/assets/5186265/44c2a7f6-195b-4a9d-81a8-69b8330957bf)
It is now possible to return the defined interval selection within Python using the `JupyterChart`
python
jchart.selections.interval.value


> cmd
> {'Horsepower': [80, 160], 'Miles_per_Gallon': [15, 30]}
>

The selection dictionary may be converted into a pandas query to filter the source DataFrame:
python
filter = " and ".join([
f"{v[0]} <= `{k}` <= {v[1]}"
for k, v in jchart.selections.interval.value.items()
])
source.query(filter)

![image](https://github.com/altair-viz/altair/assets/5186265/be57038e-9861-4164-bf84-74f3f83e4959)
Another possibility of the new `JupyerChart` class is to use `IPyWidgets` to control parameters in Altair. Here we use an ipywidget `IntSlider` to control the Altair parameter named `cutoff`.
python
import pandas as pd
import numpy as np
from ipywidgets import IntSlider, link, VBox

rand = np.random.RandomState(42)

df = pd.DataFrame({
'xval': range(100),
'yval': rand.randn(100).cumsum()
})

cutoff = alt.param(name="cutoff", value=23)

chart = alt.Chart(df).mark_point().encode(
x='xval',
y='yval',
color=alt.condition(
alt.datum.xval < cutoff,
alt.value('red'), alt.value('blue')
)
).add_params(
cutoff
)
jchart = alt.JupyterChart(chart)

slider = IntSlider(min=0, max=100, description='ipywidget')
link((slider, "value"), (jchart.params, "cutoff"))

VBox([slider, jchart])

![image](https://github.com/altair-viz/altair/assets/5186265/9297282d-5b26-4388-b74f-1f1debb5f3e9)
The `JupyterChart` class is dependent on AnyWidget. See a detailed overview in the new documentation page on [JupyterChart Interactivity](https://altair-viz.github.io/user_guide/jupyter_chart.html).
***
4. Support for field encoding inference for objects that support the DataFrame Interchange Protocol

We are maturing support for objects build upon the DataFrame Interchange Protocol in Altair.
Given the following pandas DataFrame with an ordered categorical column-type:
python
import altair as alt
from vega_datasets import data

Clean Title column
movies = data.movies()
movies["Title"] = movies["Title"].astype(str)

Convert MPAA rating to an ordered categorical
rating = movies["MPAA_Rating"].astype("category")
rating = rating.cat.reorder_categories(
['Open', 'G', 'PG', 'PG-13', 'R', 'NC-17', 'Not Rated']
).cat.as_ordered()
movies["MPAA_Rating"] = rating

Build chart using pandas
chart = alt.Chart(movies).mark_bar().encode(
alt.X("MPAA_Rating"),
alt.Y("count()")
)
chart

![image](https://github.com/altair-viz/altair/assets/5186265/236aa2bf-4cda-4265-8c5b-7eb244dc3b02)
We can convert the DataFrame to a PyArrow Table and observe that the types are now equally infered when rendering the chart.
python
import pyarrow as pa

Build chart using PyArrow
chart = alt.Chart(pa.Table.from_pandas(movies)).mark_bar().encode(
alt.X("MPAA_Rating"),
alt.Y("count()")
)
chart

![image](https://github.com/altair-viz/altair/assets/5186265/236aa2bf-4cda-4265-8c5b-7eb244dc3b02)
Vega-Altair support of the DataFrame Interchange Protocol is dependent on PyArrow.
***
5. A new transform method `transform_extent` is available

See the following example how this transform can be used:
python
import pandas as pd
import altair as alt

df = pd.DataFrame(
[
{"a": "A", "b": 28},
{"a": "B", "b": 55},
{"a": "C", "b": 43},
{"a": "D", "b": 91},
{"a": "E", "b": 81},
{"a": "F", "b": 53},
{"a": "G", "b": 19},
{"a": "H", "b": 87},
{"a": "I", "b": 52},
]
)

base = alt.Chart(df, title="A Simple Bar Chart with Lines at Extents").transform_extent(
extent="b", param="b_extent"
)
bars = base.mark_bar().encode(x="b", y="a")
lower_extent_rule = base.mark_rule(stroke="firebrick").encode(
x=alt.value(alt.expr("scale('x', b_extent[0])"))
)
upper_extent_rule = base.mark_rule(stroke="firebrick").encode(
x=alt.value(alt.expr("scale('x', b_extent[1])"))
)
bars + lower_extent_rule + upper_extent_rule

![image](https://github.com/altair-viz/altair/assets/5186265/623b36b2-1440-41dc-99bb-876210b6d642)
***
6. It is now possible to add configurable pixels-per-inch (ppi) metadata to saved and displayed PNG images
python
import altair as alt
from vega_datasets import data

source = data.cars()

chart = alt.Chart(source).mark_boxplot(extent="min-max").encode(
alt.X("Miles_per_Gallon:Q").scale(zero=False),
alt.Y("Origin:N"),
)
chart.save("box.png", ppi=300)

![image](https://user-images.githubusercontent.com/15064365/263293470-dc9ce553-96b2-4e7f-8e13-1dc0c66acd0c.png)
python
alt.renderers.enable("png", ppi=144) default ppi is 72
chart

![image](https://github.com/altair-viz/altair/assets/5186265/fce90ec1-bc8b-4ebf-b830-63f535180c2a)

Bug Fixes
* Don't call ``len`` on DataFrame Interchange Protocol objects (3111)

Maintenance
* Add support for new referencing logic in version 4.18 of the jsonschema package

Backward-Incompatible Changes
* Drop support for Python 3.7 which is end-of-life (3100)
* Hard dependencies: Increase minimum required pandas version to 0.25 (3130)
* Soft dependencies: Increase minimum required vl-convert-python version to 0.13.0 and increase minimum required vegafusion version to 1.4.0 (3163, 3160)

Release Notes by Pull Request
* Explicitly specify arguments for to_dict and to_json methods for top-level chart objects by binste in https://github.com/altair-viz/altair/pull/3073
* Add Vega-Lite to Vega compiler registry and format arg to to_dict() and to_json() by jonmmease in https://github.com/altair-viz/altair/pull/3071
* Sanitize timestamps in arrow tables by jonmmease in https://github.com/altair-viz/altair/pull/3076
* Fix ridgeline example by binste in https://github.com/altair-viz/altair/pull/3082
* Support extracting transformed chart data using VegaFusion by jonmmease in https://github.com/altair-viz/altair/pull/3081
* Improve troubleshooting docs regarding Vega-Lite 5 by binste in https://github.com/altair-viz/altair/pull/3074
* Make transformed_data public and add initial docs by jonmmease in https://github.com/altair-viz/altair/pull/3084
* MAINT: Gitignore venv folders and use gitignore for black by binste in https://github.com/altair-viz/altair/pull/3087
* Fixed Wheat and Wages case study by thomend in https://github.com/altair-viz/altair/pull/3086
* Type hints: Parts of folders "vegalite", "v5", and "utils" by binste in https://github.com/altair-viz/altair/pull/2976
* Fix CI by jonmmease in https://github.com/altair-viz/altair/pull/3095
* Add VegaFusion data transformer with mime renderer, save, and to_dict/to_json integration by jonmmease in https://github.com/altair-viz/altair/pull/3094
* Unpin vl-convert-python in dev/ci dependencies by jonmmease in https://github.com/altair-viz/altair/pull/3099
* Drop support for Python 3.7 which is end-of-life by binste in https://github.com/altair-viz/altair/pull/3100
* Add support to transformed_data for reconstructed charts (with from_dict/from_json) by binste in https://github.com/altair-viz/altair/pull/3102
* Add VegaFusion data transformer documentation by jonmmease in https://github.com/altair-viz/altair/pull/3107
* Don't call len on DataFrame interchange protocol object by jonmmease in https://github.com/altair-viz/altair/pull/3111
* copied percentage calculation in example by thomend in https://github.com/altair-viz/altair/pull/3116
* Distributions and medians of likert scale ratings by thomend in https://github.com/altair-viz/altair/pull/3120
* Support for type inference for DataFrames using the DataFrame Interchange Protocol by jonmmease in https://github.com/altair-viz/altair/pull/3114
* Add some 5.1.0 release note entries by jonmmease in https://github.com/altair-viz/altair/pull/3123
* Add a code of conduct by joelostblom in https://github.com/altair-viz/altair/pull/3124
* master -> main by jonmmease in https://github.com/altair-viz/altair/pull/3126
* Handle pyarrow-backed columns in pandas 2 DataFrames by jonmmease in https://github.com/altair-viz/altair/pull/3128
* Fix accidental requirement of Pandas 1.5. Bump minimum Pandas version to 0.25. Run tests with it by binste in https://github.com/altair-viz/altair/pull/3130
* Add Roadmap and CoC to the documentation by jonmmease in https://github.com/altair-viz/altair/pull/3129
* MAINT: Use importlib.metadata and packaging instead of deprecated pkg_resources by binste in https://github.com/altair-viz/altair/pull/3133
* Add online JupyterChart widget based on AnyWidget by jonmmease in https://github.com/altair-viz/altair/pull/3119
* feat(widget): prefer lodash-es/debounce to reduce import size by manzt in https://github.com/altair-viz/altair/pull/3135
* Fix contributing descriptions by thomend in https://github.com/altair-viz/altair/pull/3121
* Implement governance structure based on GitHub's MVG by binste in https://github.com/altair-viz/altair/pull/3139
* Type hint schemapi.py by binste in https://github.com/altair-viz/altair/pull/3142
* Add JupyterChart section to Users Guide by jonmmease in https://github.com/altair-viz/altair/pull/3137
* Add governance page to the website by jonmmease in https://github.com/altair-viz/altair/pull/3144
* MAINT: Remove altair viewer as a development dependency by binste in https://github.com/altair-viz/altair/pull/3147
* Add support for new referencing resolution in jsonschema>=4.18 by binste in https://github.com/altair-viz/altair/pull/3118
* Update Vega-Lite to 5.14.1. Add transform_extent by binste in https://github.com/altair-viz/altair/pull/3148
* MAINT: Fix type hint errors which came up with new pandas-stubs release by binste in https://github.com/altair-viz/altair/pull/3154
* JupyterChart: Add support for params defined in the extent transform by jonmmease in https://github.com/altair-viz/altair/pull/3151
* doc: Add tooltip to Line example with custom order by NickCrews in https://github.com/altair-viz/altair/pull/3155
* docs: examples: add line plot with custom order by NickCrews in https://github.com/altair-viz/altair/pull/3156
* docs: line: Improve prose on custom ordering by NickCrews in https://github.com/altair-viz/altair/pull/3158
* docs: examples: remove connected_scatterplot by NickCrews in https://github.com/altair-viz/altair/pull/3159
* Refactor optional import logic and verify minimum versions by jonmmease in https://github.com/altair-viz/altair/pull/3160
* Governance: Mark binste as committee chair by binste in https://github.com/altair-viz/altair/pull/3165
* Add ppi argument for saving and displaying charts as PNG images by jonmmease in https://github.com/altair-viz/altair/pull/3163
* Silence AnyWidget warning (and support hot-reload) in development mode by jonmmease in https://github.com/altair-viz/altair/pull/3166
* Update roadmap.rst by mattijn in https://github.com/altair-viz/altair/pull/3167
* Add return type to transform_extent by binste in https://github.com/altair-viz/altair/pull/3169
* Use import_vl_convert in _spec_to_mimebundle_with_engine for better error message by jonmmease in https://github.com/altair-viz/altair/pull/3168
* update example world projections by mattijn in https://github.com/altair-viz/altair/pull/3170
* Send initial selections to Python in JupyterChart by jonmmease in https://github.com/altair-viz/altair/pull/3172

New Contributors
* thomend made their first contribution in https://github.com/altair-viz/altair/pull/3086
* NickCrews made their first contribution in https://github.com/altair-viz/altair/pull/3155

**Full Changelog**: https://github.com/altair-viz/altair/compare/v5.0.1...v5.1.0

5.0.1

What's Changed
* Be clearer about how vegafusion works by joelostblom in https://github.com/altair-viz/altair/pull/3052
* Use altairplot Sphinx directive of sphinxext_altair package by binste in https://github.com/altair-viz/altair/pull/3056
* Fix test command in README by binste in https://github.com/altair-viz/altair/pull/3058
* Remove extra files in site-packages from wheel by jtilly in https://github.com/altair-viz/altair/pull/3057
* Add validation of Vega-Lite schema itself by binste in https://github.com/altair-viz/altair/pull/3061
* Deprecate `.ref()` instead of removing it by mattijn in https://github.com/altair-viz/altair/pull/3063
* Update area.rst by mattijn in https://github.com/altair-viz/altair/pull/3064
* Documentation: Improve homepage by binste in https://github.com/altair-viz/altair/pull/3060
* TitleParam to Title in example gallery and sync scatterplot table by joelostblom in https://github.com/altair-viz/altair/pull/3066
* Fix bug in reconstructing layered charts with from_json/from_dict by binste in https://github.com/altair-viz/altair/pull/3068


**Full Changelog**: https://github.com/altair-viz/altair/compare/v5.0.0...v5.0.1

Page 1 of 5

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.