Hide matplotlib descriptions in jupyter laptop

I'm not sure which term is right for this, but here's what I see when I plot something:

enter image description here

The graphs are actually what I want to see, but the jupyter notebook also displays the text: <matplotlib.axes._subplots.AxesSubplot at 0x1263354d0> , <matplotlib.figure.Figure at 0x1263353d0> , which I am trying to get rid of.

After some searches, I could only find plt.ioff() , which did not help me. Is there any way to get rid of the text?

+5
source share
2 answers

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

+6
source

This is a bit of a workaround, but it should work consistently:

1. Assign a function to build the binding of a variable (which can also be useful if you need to access some elements of the chart later)

 plt.figure(figsize=(3, 3)) plot = plt.plot(range(10), [x*x for x in range(10)], 'o-') 

2. Add a “pass” at the bottom of the cell (or an equivalent operation without consequences)

 plt.figure(figsize=(3, 3)) plt.plot(range(10), [x*x for x in range(10)], 'o-') pass 

3. Add a semicolon at the end of the last statement

 plt.figure(figsize=(3, 3)) plt.plot(range(10), [x*x for x in range(10)], 'o-'); 
+5
source

All Articles