Skip to content

Commit

Permalink
fix: modified tick labels to read mpl ticks labels not positions (#498)
Browse files Browse the repository at this point in the history
* fix: modified tick labels to read mpl ticks labels not positions

* ci: update tests

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
andrzejnovak and pre-commit-ci[bot] authored May 3, 2024
1 parent f6c9542 commit 6737379
Show file tree
Hide file tree
Showing 29 changed files with 11 additions and 3 deletions.
12 changes: 10 additions & 2 deletions src/mplhep/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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
Expand All @@ -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(
Expand All @@ -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]],
Expand Down
Binary file modified tests/baseline/test_hist2dplot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/baseline/test_hist2dplot_cbar_False.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/baseline/test_hist2dplot_cbar_True.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/baseline/test_hist2dplot_cbar_subplots.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/baseline/test_hist2dplot_custom_labels.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/baseline/test_hist2dplot_flow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/baseline/test_hist2dplot_hist_all_flow_hint.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/baseline/test_hist2dplot_hist_all_flow_show.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/baseline/test_hist2dplot_inputs_nobin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/baseline/test_histplot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/baseline/test_histplot_density.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/baseline/test_histplot_flow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/baseline/test_histplot_hist_flow_no_variances.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/baseline/test_histplot_hist_flow_variances.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/baseline/test_histplot_kwargs.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/baseline/test_histplot_multiple.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/baseline/test_histplot_real.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/baseline/test_histplot_stack.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/baseline/test_histplot_type_flow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/baseline/test_histplot_types.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/baseline/test_histplot_uproot_flow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/baseline/test_histplot_w2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/baseline/test_log.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/baseline/test_onebin_hist.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/baseline/test_simple.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/baseline/test_simple2d.png
Binary file modified tests/baseline/test_simple_xerr.png
2 changes: 1 addition & 1 deletion tests/test_mock.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def test_simple(mock_matplotlib):
approx([]),
yerr=1,
xerr=None,
linestyle='-',
linestyle="-",
color=ax.stairs().get_edgecolor(),
label="X",
)
Expand Down

0 comments on commit 6737379

Please sign in to comment.