Skip to content

[FEATURE] Remove fit result summary from pull plot legend as default #159

@matthewfeickert

Description

@matthewfeickert

Describe the problem, if any, that your feature request is related to

PR #149 added placing information from the fit result into the legend for pull plots by default. The example currently in the docs for plot_pull now generates this

import hist
import numpy as np
import matplotlib.pyplot as plt
from uncertainties import unumpy as unp


def pdf(x, a=1 / np.sqrt(2 * np.pi), x0=0, sigma=1, offset=0):
    exp = unp.exp if a.dtype == np.dtype("O") else np.exp
    return a * exp(-((x - x0) ** 2) / (2 * sigma ** 2)) + offset


if __name__ == "__main__":
    np.random.seed(0)

    plt.figure(figsize=(10, 8))

    hist_1 = hist.Hist(
        hist.axis.Regular(
            50, -5, 5, name="X", label="x [units]", underflow=False, overflow=False
        )
    ).fill(np.random.normal(size=1000))

    ax, pull_ax = hist_1.plot_pull(
        pdf,
        eb_ecolor="steelblue",
        eb_mfc="steelblue",
        eb_mec="steelblue",
        eb_fmt="o",
        eb_ms=6,
        eb_capsize=1,
        eb_capthick=2,
        eb_alpha=0.8,
        fp_c="hotpink",
        fp_ls="-",
        fp_lw=2,
        fp_alpha=0.8,
        bar_fc="royalblue",
        pp_num=3,
        pp_fc="royalblue",
        pp_alpha=0.618,
        pp_ec=None,
        ub_alpha=0.2,
    )
    ax.get_figure().savefig("pull_plot.png")

pull_plot

To my eye, having the fit results on the legend as they are now is not a good idea. It clutters it up and probably shouldn't be on by default. It would be better if it was off by default and required more configuration.

Describe the feature you'd like

Have the fit results not be added to the legend with no formatting by default. Have the default be no fit information added to the legend and make it configurable.

Metadata

Metadata

Labels

enhancementNew feature or requestquestionFurther information is requested

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions