Prevent Plot from Showing in Jupyter Notebook

prevent plot from showing in jupyter notebook

Perhaps just clear the axis, for example:

fig= plt.figure()
plt.plot(range(10))
fig.savefig("save_file_name.pdf")
plt.close()

will not plot the output in inline mode. I can't work out if is really clearing the data though.

How to prevent matplotlib from to showing a figure even with plt.close() in jupyter notebook

Managed to solve my problem by using plt.ioff() at the start of my training routine and plt.ion() at the end. The answer was given in a comment of the question linked by @TFer. Thanks!

jupyter notebook prevent plot from showing up on class initialization

I don't use notebooks very much, but presumably you have to turn off interactive plotting:

from matplotlib import pyplot as plt; plt.ioff()

Then show the figure after making the plot:

def make_plot(self):
x = np.linspace(0, 1)
y = np.random.normal(loc=0, scale=1, size=len(x))
self.ax.scatter(x,y)
plt.show()

Stop Matplotlib Jupyter notebooks from showing plot with animation

I believe since it's because the notebook is interactive that you are getting a plot automatically without calling plt.show. You can call plt.close to close it manually (or change the interactive mode, but you might want to keep that for other things).

fig = plt.figure()
ax = plt.axes(xlim=(0, 2), ylim=(-2, 2))
line, = ax.plot([], [], lw=2)
plt.close(fig)
...

And I would just make sure ffmpeg is installed correctly to get HTML(anim.to_html5_video()) to work. Seems like Python just can't find it.

Hide matplotlib descriptions in jupyter notebook

You can finish the corresponding (matplotlib) line with a semicolon ;



Related Topics



Leave a reply



Submit