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

How do you show multiple plots in threads concurrently? #280

Open
bionicles opened this issue Feb 21, 2025 · 2 comments
Open

How do you show multiple plots in threads concurrently? #280

bionicles opened this issue Feb 21, 2025 · 2 comments

Comments

@bionicles
Copy link

bionicles commented Feb 21, 2025

TLDR: Ultimately, my question is, would it be possible to adapt the Plot type to be Send so we could more easily show multiple plots at once? (or is there another way to achieve that? should we serialize the plot?)

I love Plotly and use it a lot, one thing I noticed is plot.show() is blocking, and the natural way to show multiple plots at once would be to send them to threads, but something about the Traces prevents us from being able to show multiple plots at the same time:

Image

Image

This is workaroundable if we create threads to both create the plot and show it, like this:

Image

but then we can't return the plots made in those threads to our main thread:

Image

also, this approach might trip up if we want to create and show multiple different kinds of plots from multiple different kinds of plot_configs, although i guess we could use an enum like this:

Image

just curious how y'all handle this, right now I'm doing the workaround but thought it would be cool if we could just make a bunch of plots and send em around without issues

@bionicles
Copy link
Author

https://gist.github.com/bionicles/76775dd1feaf9149132149f0048d820b if anybody wants the code here

@andrei-ng
Copy link
Collaborator

Hi @bionicles,
To be honest, I personally never needed something like this. And for that reason I don't have good suggestions at this moment. Feel free to submit a PR if you have an idea about it.

Also, if you want you could turn your gist into examples in the examples folder.

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