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

Different visualisation from Altair_saver #23

Closed
Amarounek opened this issue Feb 3, 2020 · 5 comments
Closed

Different visualisation from Altair_saver #23

Amarounek opened this issue Feb 3, 2020 · 5 comments

Comments

@Amarounek
Copy link

Amarounek commented Feb 3, 2020

Hello,

I would like to show you a different visualization if you use Altair_saver

Here's my code

import altair as alt
from altair_saver import save
import numpy as np
import pandas as pd

alt.data_transformers.disable_max_rows()
condition = ['Dry', 'Wet']
RSDF9 = pd.DataFrame({
    'DAY': pd.date_range('1990-01-01', freq='D', periods=10000),
    'CONDITION_RR': np.random.choice(condition , 10000,)
})

bar3 = alt.Chart(RSDF9).mark_bar().encode(
    alt.X('monthdate(DAY):O', title='day', axis=alt.Axis(tickCount=5)),
    alt.Y('year(DAY):O', title='year'),
    alt.Color('CONDITION_RR:N',
              scale=alt.Scale(
              domain=['Dry', 'Wet'],
              range=['#d62728', '#1f77b4'])),
    order=alt.Order("CONDITION_RR", sort="ascending")
)
(bar3).properties(width=600, title="Dry and Wet season (1983 - 2019)").configure_axisX(labelAlign="right", labelAngle=-45, titlePadding=5)
save(bar3, 'development_dry_season.svg')

The manually downloaded image:
image

By Altair_saver:
image

@jakevdp
Copy link
Member

jakevdp commented Feb 3, 2020

Can you share a complete code snippet that creates a chart that shows this issue? I don't know what RSDF9 is.

@Amarounek
Copy link
Author

Edited

@jakevdp
Copy link
Member

jakevdp commented Feb 3, 2020

Thanks - it looks like the width argument is not being respected, and this is the case in both the selenium and nodejs renderers. I'll try to dig-in and figure out what's happening.

If you figure anything out as you investigate further, please let me know.

@Amarounek
Copy link
Author

Ok thx!

@joelostblom
Copy link
Member

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.

@joelostblom joelostblom closed this as not planned Won't fix, can't repro, duplicate, stale Mar 30, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants