If this is all you're doing, it's probably easiest to type it out every time.
You can save a tiny bit of typing, for some loss of clarity, by setting the x and y limits with a single call; but the z limits remain separate:
ax.axis([xmin, xmax, ymin, ymax])
ax.set_zlim([zmin, zmax])
If you're doing this very often, you could create a utilities module, and start collecting functions for code snippets you use a lot.
E.g. you might find it useful to have a single function to create the 3D projection, and set the limits and labels:
def setup3d(fig, lims=None, labels=None):
ax = fig.gca(projection='3d')
if lims:
ax.set_xlim(*lims[0:2])
ax.set_ylim(*lims[2:6])
ax.set_zlim(*lims[4:6])
if labels:
ax.set_xlabel(labels[0])
ax.set_ylabel(labels[1])
ax.set_zlabel(labels[2])
return ax
fig = plt.figure()
ax = setup3d(fig, [-2, 2, 1, 5, -5, 5], ['my X', 'YYY' ,'Z'])
ax.set_lims([-5, 5], [-5, 5], [0, 5])but I don't think that all that much more clear. And how often do you have to set limits for your axes that you think this is worth the effort?