How can I check the number of dimensions of a figure? I want to be able to set custom limits of each axis, supporting both 2D and 3D plots. Of course if I attempt to set zlim for a 2D plot, I get an error.
I thought about counting the number of axis, but I don't think this will work, since other things, such as colorbars, are also condidered axes.
Best Answer