def _invert_yaxis(v_coord, axes=None): """ Inverts the y-axis of the current plot based on conditions: * If the y-axis is already inverted we don't want to re-invert it. * If v_coord is None then it will not have any attributes. * If neither of the above are true then invert y if v_coord has attribute 'positive' set to 'down'. Args: * v_coord - the coord to be plotted on the y-axis """ axes = axes if axes else plt.gca() yaxis_is_inverted = axes.yaxis_inverted() if not yaxis_is_inverted and isinstance(v_coord, iris.coords.Coord): attr_pve = v_coord.attributes.get('positive') if attr_pve is not None and attr_pve.lower() == 'down': axes.invert_yaxis()
def _invert_yaxis(v_coord, axes=None): """ Inverts the y-axis of the current plot based on conditions: * If the y-axis is already inverted we don't want to re-invert it. * If v_coord is None then it will not have any attributes. * If neither of the above are true then invert y if v_coord has attribute 'positive' set to 'down'. Args: * v_coord - the coord to be plotted on the y-axis """ axes = axes if axes else plt.gca() yaxis_is_inverted = axes.yaxis_inverted() if not yaxis_is_inverted and isinstance(v_coord, iris.coords.Coord): attr_pve = v_coord.attributes.get('positive') if attr_pve is not None and attr_pve.lower() == 'down': axes.invert_yaxis()