diff --git a/src/mplhep/plot.py b/src/mplhep/plot.py index d24083ed..16dcb7d1 100644 --- a/src/mplhep/plot.py +++ b/src/mplhep/plot.py @@ -424,7 +424,13 @@ def iterable_not_string(arg): **_kwargs, ) _e_leg = ax.errorbar( - [], [], yerr=1, xerr=None, color=_s.get_edgecolor(), label=_label, linestyle=_ls + [], + [], + yerr=1, + xerr=None, + color=_s.get_edgecolor(), + label=_label, + linestyle=_ls, ) return_artists.append( StairsArtists( @@ -545,7 +551,7 @@ def iterable_not_string(arg): ) elif flow == "show" and (underflow > 0.0 or overflow > 0.0): - xticks = ax.get_xticks().tolist() + xticks = [label.get_text() for label in ax.get_xticklabels()] lw = ax.spines["bottom"].get_linewidth() _edges = plottables[0].edges _centers = plottables[0].centers @@ -556,6 +562,7 @@ def iterable_not_string(arg): if underflow > 0.0: xticks[0] = "" xticks[1] = f"<{flow_bins[2]}" + ax.set_xticks(ax.get_xticks()) ax.set_xticklabels(xticks) ax.plot( @@ -582,6 +589,7 @@ def iterable_not_string(arg): if overflow > 0.0: xticks[-1] = "" xticks[-2] = f">{flow_bins[-3]}" + ax.set_xticks(ax.get_xticks()) ax.set_xticklabels(xticks) ax.plot( [_edges[-2], _edges[-1]], diff --git a/tests/baseline/test_hist2dplot.png b/tests/baseline/test_hist2dplot.png index a76d307f..63c1bc8e 100644 Binary files a/tests/baseline/test_hist2dplot.png and b/tests/baseline/test_hist2dplot.png differ diff --git a/tests/baseline/test_hist2dplot_cbar_False.png b/tests/baseline/test_hist2dplot_cbar_False.png index 4cf70b87..fc8f04ba 100644 Binary files a/tests/baseline/test_hist2dplot_cbar_False.png and b/tests/baseline/test_hist2dplot_cbar_False.png differ diff --git a/tests/baseline/test_hist2dplot_cbar_True.png b/tests/baseline/test_hist2dplot_cbar_True.png index a76d307f..63c1bc8e 100644 Binary files a/tests/baseline/test_hist2dplot_cbar_True.png and b/tests/baseline/test_hist2dplot_cbar_True.png differ diff --git a/tests/baseline/test_hist2dplot_cbar_subplots.png b/tests/baseline/test_hist2dplot_cbar_subplots.png index 9daad51f..b0a9ba74 100644 Binary files a/tests/baseline/test_hist2dplot_cbar_subplots.png and b/tests/baseline/test_hist2dplot_cbar_subplots.png differ diff --git a/tests/baseline/test_hist2dplot_custom_labels.png b/tests/baseline/test_hist2dplot_custom_labels.png index 505582b5..356f9cc6 100644 Binary files a/tests/baseline/test_hist2dplot_custom_labels.png and b/tests/baseline/test_hist2dplot_custom_labels.png differ diff --git a/tests/baseline/test_hist2dplot_flow.png b/tests/baseline/test_hist2dplot_flow.png index 4dabfd9d..a6e11c68 100644 Binary files a/tests/baseline/test_hist2dplot_flow.png and b/tests/baseline/test_hist2dplot_flow.png differ diff --git a/tests/baseline/test_hist2dplot_hist_all_flow_hint.png b/tests/baseline/test_hist2dplot_hist_all_flow_hint.png index c38cde4a..5f8dc57d 100644 Binary files a/tests/baseline/test_hist2dplot_hist_all_flow_hint.png and b/tests/baseline/test_hist2dplot_hist_all_flow_hint.png differ diff --git a/tests/baseline/test_hist2dplot_hist_all_flow_show.png b/tests/baseline/test_hist2dplot_hist_all_flow_show.png index 0d23a10a..1b71f6ab 100644 Binary files a/tests/baseline/test_hist2dplot_hist_all_flow_show.png and b/tests/baseline/test_hist2dplot_hist_all_flow_show.png differ diff --git a/tests/baseline/test_hist2dplot_inputs_nobin.png b/tests/baseline/test_hist2dplot_inputs_nobin.png index 5ce2daea..51b54442 100644 Binary files a/tests/baseline/test_hist2dplot_inputs_nobin.png and b/tests/baseline/test_hist2dplot_inputs_nobin.png differ diff --git a/tests/baseline/test_histplot.png b/tests/baseline/test_histplot.png index 76db1c6f..8e8c1568 100644 Binary files a/tests/baseline/test_histplot.png and b/tests/baseline/test_histplot.png differ diff --git a/tests/baseline/test_histplot_density.png b/tests/baseline/test_histplot_density.png index 5f580cf1..9376a417 100644 Binary files a/tests/baseline/test_histplot_density.png and b/tests/baseline/test_histplot_density.png differ diff --git a/tests/baseline/test_histplot_flow.png b/tests/baseline/test_histplot_flow.png index d06cca84..a4682a51 100644 Binary files a/tests/baseline/test_histplot_flow.png and b/tests/baseline/test_histplot_flow.png differ diff --git a/tests/baseline/test_histplot_hist_flow_no_variances.png b/tests/baseline/test_histplot_hist_flow_no_variances.png index 6b6cf3a8..dc23efc0 100644 Binary files a/tests/baseline/test_histplot_hist_flow_no_variances.png and b/tests/baseline/test_histplot_hist_flow_no_variances.png differ diff --git a/tests/baseline/test_histplot_hist_flow_variances.png b/tests/baseline/test_histplot_hist_flow_variances.png index c7fee59a..33204359 100644 Binary files a/tests/baseline/test_histplot_hist_flow_variances.png and b/tests/baseline/test_histplot_hist_flow_variances.png differ diff --git a/tests/baseline/test_histplot_kwargs.png b/tests/baseline/test_histplot_kwargs.png index d0626633..ef489f6c 100644 Binary files a/tests/baseline/test_histplot_kwargs.png and b/tests/baseline/test_histplot_kwargs.png differ diff --git a/tests/baseline/test_histplot_multiple.png b/tests/baseline/test_histplot_multiple.png index 014afba3..05075987 100644 Binary files a/tests/baseline/test_histplot_multiple.png and b/tests/baseline/test_histplot_multiple.png differ diff --git a/tests/baseline/test_histplot_real.png b/tests/baseline/test_histplot_real.png index 458848e6..872e86bf 100644 Binary files a/tests/baseline/test_histplot_real.png and b/tests/baseline/test_histplot_real.png differ diff --git a/tests/baseline/test_histplot_stack.png b/tests/baseline/test_histplot_stack.png index 05dc9661..1a1db5f4 100644 Binary files a/tests/baseline/test_histplot_stack.png and b/tests/baseline/test_histplot_stack.png differ diff --git a/tests/baseline/test_histplot_type_flow.png b/tests/baseline/test_histplot_type_flow.png index 7f104c6f..53378c83 100644 Binary files a/tests/baseline/test_histplot_type_flow.png and b/tests/baseline/test_histplot_type_flow.png differ diff --git a/tests/baseline/test_histplot_types.png b/tests/baseline/test_histplot_types.png index b02e1eca..9690dd91 100644 Binary files a/tests/baseline/test_histplot_types.png and b/tests/baseline/test_histplot_types.png differ diff --git a/tests/baseline/test_histplot_uproot_flow.png b/tests/baseline/test_histplot_uproot_flow.png index 66c8074f..dd0b90c6 100644 Binary files a/tests/baseline/test_histplot_uproot_flow.png and b/tests/baseline/test_histplot_uproot_flow.png differ diff --git a/tests/baseline/test_histplot_w2.png b/tests/baseline/test_histplot_w2.png index e85619a4..cd805303 100644 Binary files a/tests/baseline/test_histplot_w2.png and b/tests/baseline/test_histplot_w2.png differ diff --git a/tests/baseline/test_log.png b/tests/baseline/test_log.png index 7bfcb2fa..4a267e57 100644 Binary files a/tests/baseline/test_log.png and b/tests/baseline/test_log.png differ diff --git a/tests/baseline/test_onebin_hist.png b/tests/baseline/test_onebin_hist.png index c7f647e7..33b74545 100644 Binary files a/tests/baseline/test_onebin_hist.png and b/tests/baseline/test_onebin_hist.png differ diff --git a/tests/baseline/test_simple.png b/tests/baseline/test_simple.png index 94e72627..67fc8894 100644 Binary files a/tests/baseline/test_simple.png and b/tests/baseline/test_simple.png differ diff --git a/tests/baseline/test_simple2d.png b/tests/baseline/test_simple2d.png index 7a707c34..35e1bc92 100644 Binary files a/tests/baseline/test_simple2d.png and b/tests/baseline/test_simple2d.png differ diff --git a/tests/baseline/test_simple_xerr.png b/tests/baseline/test_simple_xerr.png index 6e2beb4e..1aa5217a 100644 Binary files a/tests/baseline/test_simple_xerr.png and b/tests/baseline/test_simple_xerr.png differ diff --git a/tests/test_mock.py b/tests/test_mock.py index d9db3e1a..98a48579 100644 --- a/tests/test_mock.py +++ b/tests/test_mock.py @@ -57,7 +57,7 @@ def test_simple(mock_matplotlib): approx([]), yerr=1, xerr=None, - linestyle='-', + linestyle="-", color=ax.stairs().get_edgecolor(), label="X", )