<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto">Hi Vincent<div><br></div><div>There are two different “interfaces” to matplotlib.  The object-oriented one (ax.plot()) and the Pyplot one (plt.plot()). The Pyplot interface is a convenience wrapper around the object oriented.  So plt.plot basically just calls ax.plot using the last-used axes (plt.gca()).  You can use the two syntaxes interchangeably but it gets confusing because the Pyplot doesn’t set the current axis or figure so you can easily end up putting things in the wrong axes.  </div><div><br></div><div>Contrary to your other correspondent I pretty strongly recommend not using the Pyplot interface.  The object oriented interface is more verbose but more explicit. The problem is that many examples are written in the Pyplot interface, though most of the official docs have made the switch.  </div><div><br></div><div>I hope that helps explain the difference. I basically only use Pyplot to initialize the figure like you did:   fig, ax = plt.subplots().  After that I just operate on fig and ax.     Which is basically what you did.  I think you didn’t find the ax.set_visible method. </div><div><br></div><div>Cheers  Jody. </div><div><br><div id="AppleMailSignature">Sent from my iPhone</div><div><br>On Dec 2, 2017, at 11:27 PM, Vincent Douce Mathoscope <<a href="mailto:mathoscope@netcourrier.com">mathoscope@netcourrier.com</a>> wrote:<br><br></div><blockquote type="cite"><div><meta http-equiv="Content-Type" content="text/html charset=utf-8">i everyone i have this code :
<br class=""><pre class="">import numpy as np
import matplotlib.pyplot as plt
import matplotlib as mpl

# choix du style pour l'affichage des équations
plt.style.use('bmh')

# dimensions de la fenetre
(L,l)=(12,8)
Linch,linch=(L/2.54,l/2.54)
fig, lafigure = plt.subplots(figsize=(Linch,linch))

# choix de la police par défaut
mpl.rcParams['font.family'] = 'STIXGeneral'
plt.rcParams["font.size"] = 10

# liste X des abscisses pour le tracé
X = np.linspace(-np.pi, np.pi, 256,endpoint=True)

# fonctions à tracer f(X)
C,S = np.cos(X), np.sin(X)

# tracé des courbes
lafigure.plot(X, C, color="blue", linewidth=1.0, linestyle="-")
lafigure.plot(X, S, color="green", linewidth=1.0, linestyle="-")

# légendes
eq=(r"$\dfrac{1}{2+\frac{2}{xy}}fontof\mathit{equation}$font of text")
plt.text(0, 0.2, eq, ha='left', va='center', alpha=1)

# graduations sur les axes
plt.xticks([-np.pi, -np.pi/2, 0, np.pi/2, np.pi], [r'$-\pi$', r'$-\pi/2$', r'$0$', r'$+\pi/2$', r'$+\pi$'])
plt.yticks([-1, 0, +1], [r'$-1$', r'$0$', r'$+1$'])
plt.axis('on')
lafigure.spines['right'].set_visible(True)

# segments
lafigure.plot([-3,-2,-1,0,1,2,3],[0.1,-0.1,0.1,-0.1,0.1,-0.1,0.1], color ='blue', linewidth=1, linestyle="-")

# petits ronds
t=2*np.pi/3
lafigure.scatter([t],[np.cos(t)], 50, color ='blue')
lafigure.scatter([t],[np.sin(t)], 50, color ='red')

lafigure.grid('true')
#lafigure.axis(True)

plt.savefig("bordas/Matplotlib_essais/9par6.png", dpi=288)
</pre><br class="">1) if i write alos this part of code, the resulting picture does not show the graph any longer, would you have an idea why ?
<br class=""><pre class=""># labels sur les axes perturbe les échelles : ne pas utiliser
#plt.xticks(np.linspace(-4,5,9,endpoint=False))
#plt.yticks(np.linspace(-1,2,7,endpoint=True))
</pre><br class="">2) i dont really understand why sometimes i have to write 
plt.something, and sometimes, thougt, only lafigure.something works ???
<br class=""><br class="">3) i have read and read these pages : 
<br class=""><a href="https://matplotlib.org/users/pyplot_tutorial.html" target="_top" rel="nofollow" link="external" class="">https://matplotlib.org/users/pyplot_tutorial.html</a><br class=""><a href="http://python-simple.com/python-matplotlib/configuration-axes.php" target="_top" rel="nofollow" link="external" class="">http://python-simple.com/python-matplotlib/configuration-axes.php</a><br class=""><a href="http://matplotlib.org/examples/pylab_examples/spine_placement_demo.html" target="_top" rel="nofollow" link="external" class="">http://matplotlib.org/examples/pylab_examples/spine_placement_demo.html</a><br class=""><a href="https://matplotlib.org/api/pyplot_api.html" target="_top" rel="nofollow" link="external" class="">https://matplotlib.org/api/pyplot_api.html</a><br class=""><br class="">and
 i cant manage to find how to display/hide the axis (x axis and y axis) 
because the word "axis" seems to be assigned to parameter the window...
<br class=""><br class="">thansk for your help, it is less urgent for me, i can start working without teses answers
<br class=""><br class="">Vincent

        
        
        <div class="signature weak-color">
                                        ––––––––––––––––––––––––––
<br class="">                  Vincent Douce
<br class="">               :=: Mathoscope :=:
<br class="">             <a href="http://mathoscope.xyz" target="_top" rel="nofollow" link="external" class="">http://mathoscope.xyz</a><br class="">                 06°13°11°07°26
<br class="">          Bagnères de Bigorre 65200    </div><div apple-content-edited="true" class="">
<div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="orphans: auto; text-align: start; text-indent: 0px; widows: auto; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="color: rgb(0, 0, 0); letter-spacing: normal; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; orphans: auto; text-align: start; text-indent: 0px; widows: auto; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""></div></div></div></div></div></div></div></div></blockquote><blockquote type="cite"><div><span>_______________________________________________</span><br><span>Matplotlib-users mailing list</span><br><span><a href="mailto:Matplotlib-users@python.org">Matplotlib-users@python.org</a></span><br><span><a href="https://mail.python.org/mailman/listinfo/matplotlib-users">https://mail.python.org/mailman/listinfo/matplotlib-users</a></span><br></div></blockquote></div></body></html>