def scatter(h1: Histogram1D, ax: Axes, *, errors: bool = False, **kwargs):
    """Scatter plot of 1D histogram."""
    show_stats = kwargs.pop("show_stats", False)
    show_values = kwargs.pop("show_values", False)
    density = kwargs.pop("density", False)
    cumulative = kwargs.pop("cumulative", False)
    value_format = kwargs.pop("value_format", None)
    text_kwargs = pop_kwargs_with_prefix("text_", kwargs)

    data = get_data(h1, cumulative=cumulative, density=density)

    if "cmap" in kwargs:
        cmap = _get_cmap(kwargs)
        _, cmap_data = _get_cmap_data(data, kwargs)
        kwargs["color"] = cmap(cmap_data)
    else:
        kwargs["color"] = kwargs.pop("color", "blue")

    _apply_xy_lims(ax, h1, data, kwargs)
    _add_ticks(ax, h1, kwargs)
    _add_labels(ax, h1, kwargs)

    if errors:
        err_data = get_err_data(h1, cumulative=cumulative, density=density)
        ax.errorbar(h1.bin_centers, data, yerr=err_data, fmt=kwargs.pop("fmt", "o"),
                    ecolor=kwargs.pop("ecolor", "black"), ms=0)
    ax.scatter(h1.bin_centers, data, **kwargs)

    if show_values:
        _add_values(ax, h1, data, value_format=value_format, **text_kwargs)
    if show_stats:
        _add_stats_box(h1, ax, stats=show_stats)
def scatter ( h1 : Histogram1D , ax : Axes , * , errors : bool = False , ** kwargs ) : show_stats = kwargs . pop ( "show_stats" , False ) show_values = kwargs . pop ( "show_values" , False ) density = kwargs . pop ( "density" , False ) cumulative = kwargs . pop ( "cumulative" , False ) value_format = kwargs . pop ( "value_format" , None ) text_kwargs = pop_kwargs_with_prefix ( "text_" , kwargs ) data = get_data ( h1 , cumulative = cumulative , density = density ) if "cmap" in kwargs : cmap = _get_cmap ( kwargs ) _ , cmap_data = _get_cmap_data ( data , kwargs ) kwargs [ "color" ] = cmap ( cmap_data ) else : kwargs [ "color" ] = kwargs . pop ( "color" , "blue" ) _apply_xy_lims ( ax , h1 , data , kwargs ) _add_ticks ( ax , h1 , kwargs ) _add_labels ( ax , h1 , kwargs ) if errors : err_data = get_err_data ( h1 , cumulative = cumulative , density = density ) ax . errorbar ( h1 . bin_centers , data , yerr = err_data , fmt = kwargs . pop ( "fmt" , "o" ) , ecolor = kwargs . pop ( "ecolor" , "black" ) , ms = 0 ) ax . scatter ( h1 . bin_centers , data , ** kwargs ) if show_values : _add_values ( ax , h1 , data , value_format = value_format , ** text_kwargs ) if show_stats : _add_stats_box ( h1 , ax , stats = show_stats )
Scatter plot of 1D histogram.