Open ruochiz opened 3 months ago
That's weird. I've never encountered an issue with it breaking things. Usually, we wanted PDFs so we could use them in other things are well (like as part of paper figures). Can you elaborate a little more on when you're encountering an issue and how you fixed it?
Oh. just if I from modiscolite.report import xxx
within a jupyter notebook, after than any plt.scatter
or sns.scatterplot
won't display the figure in the notebook.
To revert back to the original mode, I need to
mpl.use('module://matplotlib_inline.backend_inline')
%matplotlib inline
basically revert back to the inline backend. If you save fig with a .pdf last name, would it just save the figures as a vector graphics without the need to explicit change backend?
Isn't it the expected behavior in a notebook that, unless you enable the inline behavior, it won't display figures in the notebook? I think I just always just enable inline mode, though I don't have to use mlp.use...
And no, it doesn't matter what you call the file, it matters how you save it. If you don't do matplotlib.use('pdf')
but save the figure to a file named <something>.pdf
it will still be a jpg. It'll just be called a pdf.
I think the bigger issue you're pointing out is that importing tfmodisco will cause all figures afterward to be saved as pdfs. I'll see if I can move that to a local function -- hopefully that will resolve the issue.
Hum, https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.savefig.html#matplotlib.pyplot.savefig
I'm pretty sure matplotlib automatically matches filenames to a format and use the underlying backend to save it.
Huh, my mistake, looks like you're right. I'll look into this more.
https://github.com/jmschrei/tfmodisco-lite/blob/3c6e38f3ad5df80c55bd4e8c7c2a531ee0a2b316/modiscolite/report.py#L11C1-L12C22
Hi,
thank you for creating this easy to use and fast version of modisco, I wonder what's the reason for calling .use("pdf") here, to provide some background. I was trying to use some functions in modiscolite in a notebook, and apparently calling .use("pdf") breaks the rendering system in jupyter notebook (unless one specifically convert back to the backend and do %inline before each figures to make).
Is it possible to just remove this?