Skip to content
This repository has been archived by the owner on Apr 9, 2024. It is now read-only.

Make altair-saver compatible with pathlib.Path #86

Closed
wants to merge 2 commits into from

Conversation

EntilZha
Copy link

I made a couple minor changes so that pathlib.Path can be passed into save(). The code below works, but I wasn't sure if/where to add it in tests since they use io.StringIO so don't write to an actual file.

from pathlib import Path

import altair as alt
import pandas as pd

import altair_saver

data = pd.DataFrame({'a': list('CCCDDDEEE'),
                     'b': [2, 7, 4, 1, 2, 6, 8, 4, 7]})

chart = alt.Chart(data).mark_point().encode(
    x='a',
    y='b'
)
altair_saver.save(chart, "/tmp/chart.pdf")
altair_saver.save(chart, Path("/tmp/chart.pdf"))

@EntilZha
Copy link
Author

Whoops, guess I should have looked at open PRs, just saw the other one. Feel free to close this one...

@joelostblom
Copy link
Member

Thanks for you PR @EntilZha . As you have noticed, there hasn't been any development in this repo for a while. Since Altair 5.2, the functionality of Altair Saver is now available in Altair via the vl-convert package. Most of the functionality has been available since 5.0, and the main addition in 5.2 was PDF export. See the docs on how to save charts for more details.

We are going to archive this repo, so I'm closing all the open issues and PRs before doing so. Try out the new options for saving charts mentioned above and if you run into issues, please open an issue directly in the altair or vl-convert repo.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants