Skip to content
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

Save order is always wrong #172

Open
zhimin-z opened this issue Jan 13, 2024 · 2 comments
Open

Save order is always wrong #172

zhimin-z opened this issue Jan 13, 2024 · 2 comments

Comments

@zhimin-z
Copy link

zhimin-z commented Jan 13, 2024

I am using Plotly and my Python environment is as follows:

python==3.11.6
plotly==5.18.0
kaleido==0.2.1

When I write the following code and execute:

import plotly.express as px

# Create multiple figure objects
fig1 = px.scatter(x=[1, 2, 3], y=[4, 5, 6], title="Figure 1")
fig2 = px.bar(x=[1, 2, 3], y=[7, 8, 9], title="Figure 2")
fig3 = px.line(x=[1, 2, 3], y=[10, 11, 12], title="Figure 3")

# Specify the order in which you want to save the figures
figures_to_save = [fig1, fig2, fig3]

# Loop through the figures and save them in the desired order
for i, fig in enumerate(figures_to_save):
    fig.write_image(f"figure_{i+1}.png")

The generated figure is misordered as follows:
figure_1.png
image
figure_2.png
image
figure_3.png
image

I wonder why this happens and how I can fix it?

@ChrisJaunes
Copy link

What is your kaleido version?

python3.10
plotly=5.18.0
kaleido=0.2.1

The save order is normal

@zhimin-z
Copy link
Author

zhimin-z commented Jan 16, 2024

What is your kaleido version?

python3.10
plotly=5.18.0
kaleido=0.2.1

The save order is normal

Same as yours except for the python version. This is pretty weird since the wrong order is flaky now. I cannot reproduce it anymore...

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

No branches or pull requests

2 participants