Search code examples
matplotlibrangeaxes

How do I get the current limits of a matplotlib axis?


Given a matplotlib axis, how do I find its current min and max limits; e.g., as might have been previously set in ax.set(xscale='log', xlim=...)?


Solution

  • xmin,xmax = ax.get_xlim()

    ymin,ymax = ax.get_ylim()