<div dir="ltr"><div>fig.gca(projection='3d') is perfectly valid, but you need to realize what it does. It will only work if it is a single plot in the figure, and that that is the *first* reference to the plot. If some other plotting action has already happened, then it wouldn't work, because fig.gca() means "get the current axes in the figure, if it exists; if it doesn't exist yet, create one with these parameters". So, if an axes already exists, then it'll fetch that one, and it may not be a 3d axes. Also, if you plan to do subplots, then `gca()` may be limiting since it is not explicit about which subplot in a figure it is referring to.<br><br></div><div>Cheers!<br></div>Ben Root<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Mar 22, 2017 at 1:57 PM, Jean-Philippe Grivet <span dir="ltr"><<a href="mailto:jean-philippe.grivet@wanadoo.fr" target="_blank">jean-philippe.grivet@wanadoo.fr</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Thanks a lot Benjamin and Vincent for your most kind and detailed answers.<br>
<br>
In reply to Vincent, I regret that the authors of Matplotkib did not pursue<br>
the wrapper idea and propose a function plot3d(x,y,z); it would make life simpler.<br>
<br>
I copied from the net (I can't remember where) the following code fragment:<br>
<br>
from mpl_toolkits.mplot3d import Axes3D<br>
import numpy as np<br>
import matplotlib.pyplot as pt<br>
<br>
fig = pt.figure()<br>
ax = fig.gca(projection='3d')<br>
................<br>
surf = ax.plot_wireframe(X, Y, Z, rstride = 10,cstride = 10)<br>
<br>
which looks rather similar to Matlab syntax and works well for me.<br>
 Is that considered to be obsolete or in bad style ?<br>
<br>
Thanks again,<br>
Jean-Philippe<br>
<br>
<br>
</blockquote></div><br></div>