-
Notifications
You must be signed in to change notification settings - Fork 794
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support saving to PDF with VlConvert 1.0 #3244
Conversation
Thanks for this PR @jonmmease, quite awesome to see all of this progress around vl-convert! import altair as alt
import pandas as pd
source = pd.DataFrame({
'a': ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I'],
'b': [28, 55, 43, 91, 81, 53, 19, 87, 52],
})
chart = alt.Chart(source).mark_bar().encode(x='a', y='b')
chart.save('chart.pdf') I get the following error:
Which surprises me. I was expecting an error coming from the alt.utils._importers.import_vl_convert()
But if I do import vl_convert as vlc
print(vlc.__version__)
vlc.vegalite_to_pdf(chart.to_json()) I get a successful pdf:
We should probably be raising an And based on the vl-convert v0.14.0 release page, I'm wondering if the bump to vl-convert 1.0 is already required part of this PR? |
I added a commit: 07ae53a. I think a |
Thanks for the review and for trying it out @mattijn! I'm happy with change you made. Are you ready for this to be merged?
Yeah, for PDF vl-convert-python 0.14.0 would be ok (though there was at least one PDF bug fix since 0.14.0), but I want to open a PR with offline HTML support after this and that will require 1.0.0. |
Yes, fine with merging. In a follow up PR will also try to improve the current error message if a too low version is detected. I like the part that you get some info how to upgrade using pip or conda, but currently you only get to see this if you don't have the soft dependency installed. Also mentioning that it is a soft dependency is helpful I think. |
VlConvert 1.0 was just released and it includes support for saving charts to PDF. This PR bumps the minimum version of vl-convert-python to 1.0.0 and adds support for saving to PDF with the
vl-convert
engine.This brings vl-convert to feature parity with
altair_saver
, so I added a deprecation warning when the altair_saver engine is used. I'm thinking we could drop altair_saver support in Altair 5.3.0.