Example #1
0
def _set_limits_matplotlib(axes: plt.Axes.axes,
                           limits: Union[List[Tuple[float, float]],
                                         Tuple[float, float]]):
    """Set the limits of an axes object.

    Parameters
    ----------
    axes : matplotlib.axes.Axes
        The axes object
    limits :  Tuple[float, float] or List[Tuple[float, float]]
        Each tuple marks lower and upper boundary of the x, y and z axis. If only a
        single tuple is passed, the boundaries are used for all axis. If `None`
        is provided, the axis are adjusted to be of equal length.

    """
    if limits is None:
        set_axes_equal(axes)
    else:
        if isinstance(limits, Tuple):
            limits = [limits]
        if len(limits) == 1:
            limits = [limits[0] for _ in range(3)]
        axes.set_xlim(limits[0])
        axes.set_ylim(limits[1])
        axes.set_zlim(limits[2])
Example #2
0
 def __call__(self, ax: pyplot.Axes.axes):
     try:
         ax.set_ylim(0., max_levels)
     except RecursionError as e:
         pass