Replies: 5 comments 16 replies
-
I agree with this, I think it is important that the out of the box experience includes the most crucial conveniences for users and I think smaller sized charts by default is one of these and aligns closely with what the user would likely expect when making a chart (i. e. only the data required to display the chart is included in the spec unless explicitly instructed to include all data)
I think this sounds like a good solution to me. I wonder if the kwarg should be called
On the top of my head, I would be in favor of this. Could you give a rough indication of the amount of code that would be integrated into Altair, is it a few hundred lines or thousands? And thank you for offering to do the maintenance of this part of the code for the library, I personally think that sounds like the ideal solution.
I think this would be great, and having a similar conda package would be convenient as well, but I am not sure if conda supports this functionality now or if we would need to create a meta package.
Thanks for noting this, makes sense! |
Beta Was this translation helpful? Give feedback.
-
And a follow up question, if we go this route, should the VegaFusion widget also be part of the extra_requires dependencies that are installed with |
Beta Was this translation helpful? Give feedback.
-
I've been using VegaFusion for a while now, mainly the mimetype renderer, and i also find it a very very "cool piece of technology"! :) It would be great to have it tighter integrated into Altair so that many more users can reap the benefits of this. +1 on everything said so far (with the caveat regarding enabling it by default, see below) and thank you @jonmmease for offering to do the integration! The example integration sounds good to me. I'm wondering how we can enable the mimetype renderer by default if VegaFusion is installed without breaking too much. I think it's definitely worth trying and it's something to be looked at during the implementation. But just as an example, let's say an application creates an Altair chart, converts it to json with In any case, very much looking forward to this! Happy to support with the implementation and review. |
Beta Was this translation helpful? Give feedback.
-
@mattijn, do you have thoughts on the topic? |
Beta Was this translation helpful? Give feedback.
-
I've started playing some with how to integrate VegaFusion into the Altair rendering pipeline, and I think I have a pretty clean solution to propose. First, add a new data transformer named "vegafusion". This data transformer will extract the dataframe-like data sources into a private Other parts of Altair will check whether the active data transformer is named "vegafusion", and if so they will:
(In practice this will all be wrapped up in a utility method) So far, I've thought of three places to insert this logic:
A nice consequence of this approach is that a user will only need to run: alt.data_transformers.enable("vegafusion") And then Altair will automatically use VegaFusion everywhere it makes sense. Let me know what you think! If this general direction makes sense I'll work on a PR and we can discuss more there. Thanks! |
Beta Was this translation helpful? Give feedback.
-
Now that Altair 5 is out (thanks again to @mattijn @joelostblom and @binste for all of the work to make this a reality!), I wanted to start a discussion on the future relationship between VegaFusion and Altair. This is also in response to @joelostblom's question in #3053.
Even though VegaFusion is a cool piece of technology, it's not really something an end user of Altair should need to think about. From my perspective, It would be great if the capabilities added by VegaFusion were just seen as capabilities of Altair itself to the casual user.
Today, the VegaFusion Python library consists of two parts. A low-level runtime that deals exclusively with dictionaries of Vega specs and has no dependency on Altair (e.g.
vf.runtime.pre_transform_spec
). And higher level entry points that integrate with Altair using vl-convert (e.g. the mime renderer, save functions, andtransformed_data
function).A question for the Altair community is whether we would be interested in making VegaFusion an optional dependency and then port this high-level functionality into Altair itself.
Example Integrations
Here are a couple of examples of what the more integrated functionality could look like:
The existing renderers could get a
vegafusion
kwarg to control whether serverside transformation is used (and it could default toTrue
if VegaFusion is installed).or for the VegaFusion widget renderer
Similarly, the
Chart.save
method could have avegafusion
kwarg to control whether transformations are applied before saving the chart:Charts could have a
.transformed_data()
method alongside their existing.data
property to access the chart's data post transformation:And the
vegafusion[embed]
package specification could be added to anextra_requires
group to install automatically withpip install altair[full]
.Always optional
As with vl-convert, it's important that a VegaFusion dependency always be optional since VegaFusion is a compiled library and won't be available everywhere that Altair currently works (e.g. in pyodide).
Development and Maintenance
If we want to go this direction, I'd be happy to do the bulk of the integration work and to join as an Altair maintainer.
Beta Was this translation helpful? Give feedback.
All reactions