vega / altair

Declarative statistical visualization library for Python
https://altair-viz.github.io/
BSD 3-Clause "New" or "Revised" License
9.26k stars 793 forks source link

Support array interchange protocols #3077

Open mattijn opened 1 year ago

mattijn commented 1 year ago

Investigate how we can support the contour mark in vega-lite from the altair side. See https://github.com/vega/vega-lite/issues/6043#issuecomment-1567460160 for a PoC.

Array-based packages in python have adopted dlpack as array API standard through the .__dlpack__ interface. Potential support through pyarrow might be realized through https://github.com/apache/arrow/issues/33984.

It would be great if we can use facet/row/column by axis/dimension in the array or tensor.

mattijn commented 4 months ago

See also: https://github.com/loco-philippe/ntv-numpy which is a new json representation dataformat and standard for multidimensional array data.

mattijn commented 4 weeks ago

See also https://github.com/data-apis/array-api-compat which is a compatibility layer for common array libraries to support the Array API.

The Array API is not touching IO. The existing array data interchange protocol of DLPack is used here. To access this in a server-side accelerator like VegaFusion https://github.com/ehsanmok/dlpackrs can be used which is a DLPack safe Rust binding of the DLPack data interchange protocol.

dangotbanned commented 4 weeks ago

@mattijn I know there is more to it than this, but is this able to help at all?

It wouldn't cover the alt.Chart(data=...) part, but maybe there are other places you could throw some arrays at?

Also, pinging @MarcoGorelli as I've seen these: