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 to load a matplotlib / seaborn plot that was already created #60

Open
ThomVett opened this issue Jul 10, 2024 · 0 comments
Open

How to load a matplotlib / seaborn plot that was already created #60

ThomVett opened this issue Jul 10, 2024 · 0 comments

Comments

@ThomVett
Copy link

ThomVett commented Jul 10, 2024

Hello,

Thanks for this cool library - super helpful!

I'm creating plots in multiple notebooks / python scripts and save them to pickle. Than from a central notebook I combine them in the final figure using patchworklib. to do this i am trying it in two different ways:

  • Exporting bricks object to pickle and loading the pickle object somewhere else
import seaborn as sns
import patchworklib as pw
ax = pw.Brick(figsize=(3, 2))
sns.lineplot(melted_dilution, x="VAF %", y="Metric Value", hue="Metric", ax=ax)
dump_to_pickle(ax)

and than in another notebook

ax = load_pickle(path_to_file)
ax.savefid()
  • Exporting the matplotlib figure object, loading it in the other notebook and putting the ax in the Bricks object
import seaborn as sns
ax=sns.lineplot(melted_dilution, x="VAF %", y="Metric Value", hue="Metric")
dump_to_pickle(ax.get_figure())

and than in another notebook

fig = load_pickle(path_to_file)
brick =pw.Brick(ax=fig.axes[0])

the problem i have is that in both of these ways:

  • the bricks object contains the figure and the axes (i.e brick.figure returns the plot)
  • but if i do brick.savefig("test.png") or just brick in the notebook there is only a blank canvas.

any advice on how to do this?

Thanks a lot!

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

1 participant