Skip to content

ORDERED_PAIR_XY_INVERT

Return an OrderedPair with the axes inverted. Params: default : OrderedPair The input OrderedPair that we would like to invert the axes. Returns: out : OrderedPair The OrderedPair that is inverted.
Python Code
from flojoy import flojoy, OrderedPair


@flojoy
def ORDERED_PAIR_XY_INVERT(
    default: OrderedPair,
) -> OrderedPair:
    """Return an OrderedPair with the axes inverted.

    Parameters
    ----------
    default : OrderedPair
        The input OrderedPair that we would like to invert the axes.

    Returns
    -------
    OrderedPair
        The OrderedPair that is inverted.
    """

    return OrderedPair(x=default.y, y=default.x)

Find this Flojoy Block on GitHub

Example

Having problems with this example app? Join our Discord community and we will help you out!
React Flow mini map

In this example, generate a OrderedPair type using VECTOR_2_ORDERED_PAIR node.

Use ORDERED_PAIR_XY_INVERT to invert the X and Y axes of the generated output.

Compare the nodes that is not inverted and inverted using visualization node.