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

Help with saving figures #15

Closed
JasonOSS opened this issue Jan 25, 2023 · 1 comment
Closed

Help with saving figures #15

JasonOSS opened this issue Jan 25, 2023 · 1 comment
Labels

Comments

@JasonOSS
Copy link

Hello,

I am having difficulties saving the figure generated by Dictys.

For exemple, for Heatmap of regulation strengths between select TFs and their top targets in select cell types.

I tried to save using:
fig,fig_colorbar,net=fig_heatmap_top(d0,tf,ntop=ntop,direction=direction,aspect=1,gann='all')
plt.savefig("figname.png") but this is only saving the legend.

Could you please help me to find the way to save the figure ?

For :

TF discovery based on 4 patterns of highly variable regulatory activity over developmental trajectory (discovery.ipynb)

I used:
#Value range for coloring
vrange={
'Terminal logFC':[-4.5,4.5],
'Transient logFC':[-1.5,1.5],
'Switching time':[0.2,0.8],
}

for branchname in branches:
print(branchname)
figs=d0.draw_discover(*branches[branchname],ntops=(12,12,2,2),vrange=vrange)
plt.show()
for i,fig in enumerate(figs):
fig[0].savefig('TF_Discovery--branch{}-fig{}.png'.format(branchname,i), bbox_inches='tight', dpi = 300)

But I am not sure I can use this here.

Maybe it could be useful to add exemples for saving this figure in the notebooks ?

Thanks a lot !

@lingfeiwang
Copy link
Collaborator

Hi JasonOSS,

Thank you for the suggestion. Yes, you should do fig.savefig('fig.png') and fig_colorbar.savefig('colorbar.png') instead. See https://matplotlib.org/stable/api/figure_api.html#matplotlib.figure.Figure.savefig.

I will add some note on saving figures in the next version. You are welcome to let us know if you have any additional suggestions or questions.

Lingfei

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

No branches or pull requests

2 participants