def plot_macadam(
    ellipse_scaling=10,
    plot_filter_positions=False,
    plot_standard_deviations=False,
    plot_rgb_triangle=True,
    plot_mesh=True,
    n=1,
    xy_to_2d=lambda xy: xy,
    axes_labels=("x", "y"),
):
    """See <https://en.wikipedia.org/wiki/MacAdam_ellipse>,
    <https://doi.org/10.1364%2FJOSA.32.000247>.
    """
    dir_path = os.path.dirname(os.path.realpath(__file__))
    with open(os.path.join(dir_path, "data/macadam1942/table3.yaml")) as f:
        data = yaml.safe_load(f)

    # if plot_filter_positions:
    #     with open(os.path.join(dir_path, 'data/macadam1942/table1.yaml')) as f:
    #         filters_xyz = yaml.safe_load(f)
    #     filters_xyz = {
    #         key: 100 * numpy.array(value) for key, value in filters_xyz.items()
    #         }
    #     for key, xyz in filters_xyz.items():
    #         x, y = xyz100_to_2d(xyz)
    #         plt.plot(x, y, 'xk')
    #         ax.annotate(key, (x, y))

    # collect the ellipse centers and offsets
    centers = []
    offsets = []
    for datak in data:
        # collect ellipse points
        _, _, _, _, delta_y_delta_x, delta_s = numpy.array(datak["data"]).T

        offset = (
            numpy.array([numpy.ones(delta_y_delta_x.shape[0]), delta_y_delta_x])
            / numpy.sqrt(1 + delta_y_delta_x ** 2)
            * delta_s
        )

        if offset.shape[1] < 2:
            continue

        centers.append([datak["x"], datak["y"]])
        offsets.append(numpy.column_stack([+offset, -offset]))

    centers = numpy.array(centers)

    _plot_ellipse_data(
        centers,
        offsets,
        ellipse_scaling=ellipse_scaling,
        xy_to_2d=xy_to_2d,
        plot_mesh=plot_mesh,
        n=n,
        plot_rgb_triangle=plot_rgb_triangle,
    )
    return
See <https://en.wikipedia.org/wiki/MacAdam_ellipse>,
    <https://doi.org/10.1364%2FJOSA.32.000247>.