plothist 1.7.0__tar.gz → 1.8.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {plothist-1.7.0 → plothist-1.8.0}/.github/ISSUE_TEMPLATE/user-story.md +5 -5
- {plothist-1.7.0 → plothist-1.8.0}/.github/workflows/cd.yaml +5 -7
- {plothist-1.7.0 → plothist-1.8.0}/.github/workflows/ci.yaml +10 -7
- {plothist-1.7.0 → plothist-1.8.0}/.github/workflows/coverage.yaml +2 -4
- {plothist-1.7.0 → plothist-1.8.0}/.pre-commit-config.yaml +16 -6
- plothist-1.8.0/AUTHORS.md +2 -0
- {plothist-1.7.0 → plothist-1.8.0}/CITATION.cff +7 -7
- {plothist-1.7.0 → plothist-1.8.0}/LICENSE +1 -1
- {plothist-1.7.0 → plothist-1.8.0}/PKG-INFO +14 -7
- {plothist-1.7.0 → plothist-1.8.0}/README.rst +4 -2
- {plothist-1.7.0 → plothist-1.8.0}/docs/CONTRIBUTING.rst +3 -3
- {plothist-1.7.0 → plothist-1.8.0}/docs/conf.py +1 -1
- {plothist-1.7.0 → plothist-1.8.0}/docs/usage/installation.rst +1 -1
- {plothist-1.7.0 → plothist-1.8.0}/noxfile.py +21 -10
- {plothist-1.7.0 → plothist-1.8.0}/pyproject.toml +35 -8
- {plothist-1.7.0 → plothist-1.8.0}/src/plothist/_version.py +2 -2
- {plothist-1.7.0 → plothist-1.8.0}/src/plothist/comparison.py +1 -1
- {plothist-1.7.0 → plothist-1.8.0}/src/plothist/examples/advanced/1d_side_by_side_with_numbers.py +1 -1
- {plothist-1.7.0 → plothist-1.8.0}/src/plothist/examples/advanced/asymmetry_comparison_advanced.py +3 -2
- {plothist-1.7.0 → plothist-1.8.0}/src/plothist/examples/utility/color_palette_squares.py +8 -3
- {plothist-1.7.0 → plothist-1.8.0}/src/plothist/histogramming.py +1 -2
- {plothist-1.7.0 → plothist-1.8.0}/src/plothist/plothist_style.py +24 -13
- {plothist-1.7.0 → plothist-1.8.0}/src/plothist/plotters.py +32 -29
- {plothist-1.7.0 → plothist-1.8.0}/src/plothist/variable_registry.py +25 -15
- {plothist-1.7.0 → plothist-1.8.0}/tests/test_variable_registry.py +37 -0
- plothist-1.8.0/uv.lock +1583 -0
- plothist-1.7.0/AUTHORS.md +0 -2
- plothist-1.7.0/uv.lock +0 -1988
- {plothist-1.7.0 → plothist-1.8.0}/.github/dependabot.yaml +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/.github/release.yaml +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/.github/workflows/pr.yaml +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/.gitignore +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/.readthedocs.yaml +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/CONTRIBUTING.md +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/codecov.yml +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/docs/advanced/model_examples.rst +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/docs/advanced/other_advanced.rst +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/docs/basics/1d_func.rst +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/docs/basics/1d_hist.rst +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/docs/basics/2d_hist.rst +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/docs/basics/variable_registry.rst +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/docs/documentation/documentation.rst +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/docs/documentation/statistics.rst +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/docs/documentation/troubleshooting.rst +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/docs/img/1d_comparison_advanced.png +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/docs/img/1d_comparison_advanced.svg +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/docs/img/1d_comparison_asymmetry.png +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/docs/img/1d_comparison_difference.png +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/docs/img/1d_comparison_efficiency.png +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/docs/img/1d_comparison_only_efficiency.png +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/docs/img/1d_comparison_pull.png +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/docs/img/1d_comparison_ratio.png +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/docs/img/1d_comparison_relative_difference.png +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/docs/img/1d_comparison_split_ratio.png +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/docs/img/1d_elt1.png +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/docs/img/1d_elt1_stacked.png +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/docs/img/1d_elt2.png +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/docs/img/1d_hist_simple.png +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/docs/img/1d_int_category.png +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/docs/img/1d_profile.png +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/docs/img/1d_side_by_side.png +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/docs/img/1d_side_by_side_with_numbers.png +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/docs/img/1d_str_category.png +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/docs/img/2d_hist_correlations_0.png +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/docs/img/2d_hist_correlations_1.png +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/docs/img/2d_hist_correlations_2.png +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/docs/img/2d_hist_simple.png +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/docs/img/2d_hist_simple_discrete_colormap.png +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/docs/img/2d_hist_uneven.png +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/docs/img/2d_hist_with_projections.png +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/docs/img/2d_hist_with_projections.svg +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/docs/img/add_text_example.png +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/docs/img/asymmetry_comparison_advanced.png +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/docs/img/color_palette_hists.png +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/docs/img/fct_1d.png +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/docs/img/fct_1d_stacked.png +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/docs/img/matplotlib_example.png +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/docs/img/model_all_comparisons.png +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/docs/img/model_all_comparisons_no_model_unc.png +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/docs/img/model_examples_flatten2D.png +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/docs/img/model_examples_pull.png +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/docs/img/model_examples_pull_no_model_unc.png +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/docs/img/model_examples_stacked.png +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/docs/img/model_examples_stacked.svg +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/docs/img/model_examples_stacked_unstacked.png +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/docs/img/model_examples_unstacked.png +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/docs/img/model_with_stacked_and_unstacked_function_components.png +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/docs/img/model_with_stacked_and_unstacked_histograms_components.png +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/docs/img/plothist_example.png +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/docs/img/pyhf_example.svg +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/docs/img/ratio_data_vs_model_with_stacked_and_unstacked_function_components.png +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/docs/img/savefig_comparisons.gif +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/docs/img/uncertainty_types.png +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/docs/img/usage_YlGnBu_r_palette.png +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/docs/img/usage_coolwarm_palette.png +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/docs/img/usage_cubehelix.png +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/docs/img/usage_style_cycle.png +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/docs/img/usage_viridis_palette.png +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/docs/index.rst +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/docs/usage/plot_fitting_results.rst +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/docs/usage/style.rst +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/docs/usage/utilities.rst +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/src/plothist/__init__.py +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/src/plothist/_version.pyi +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/src/plothist/default_style.mplstyle +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/src/plothist/examples/1d_hist/1d_comparison_asymmetry.py +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/src/plothist/examples/1d_hist/1d_comparison_difference.py +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/src/plothist/examples/1d_hist/1d_comparison_efficiency.py +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/src/plothist/examples/1d_hist/1d_comparison_only_efficiency.py +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/src/plothist/examples/1d_hist/1d_comparison_pull.py +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/src/plothist/examples/1d_hist/1d_comparison_ratio.py +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/src/plothist/examples/1d_hist/1d_comparison_relative_difference.py +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/src/plothist/examples/1d_hist/1d_comparison_split_ratio.py +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/src/plothist/examples/1d_hist/1d_elt1.py +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/src/plothist/examples/1d_hist/1d_elt1_stacked.py +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/src/plothist/examples/1d_hist/1d_elt2.py +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/src/plothist/examples/1d_hist/1d_hist_simple.py +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/src/plothist/examples/1d_hist/1d_int_category.py +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/src/plothist/examples/1d_hist/1d_profile.py +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/src/plothist/examples/1d_hist/1d_side_by_side.py +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/src/plothist/examples/1d_hist/1d_str_category.py +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/src/plothist/examples/1d_hist/README.rst +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/src/plothist/examples/2d_hist/2d_hist_correlations.py +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/src/plothist/examples/2d_hist/2d_hist_simple.py +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/src/plothist/examples/2d_hist/2d_hist_simple_discrete_colormap.py +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/src/plothist/examples/2d_hist/2d_hist_uneven.py +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/src/plothist/examples/2d_hist/2d_hist_with_projections.py +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/src/plothist/examples/2d_hist/README.rst +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/src/plothist/examples/README.rst +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/src/plothist/examples/advanced/1d_comparison_advanced.py +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/src/plothist/examples/advanced/README.rst +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/src/plothist/examples/advanced/model_examples_flatten2D.py +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/src/plothist/examples/func_1d/README.rst +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/src/plothist/examples/func_1d/fct_1d.py +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/src/plothist/examples/func_1d/fct_1d_stacked.py +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/src/plothist/examples/model_ex/README.rst +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/src/plothist/examples/model_ex/model_all_comparisons.py +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/src/plothist/examples/model_ex/model_all_comparisons_no_model_unc.py +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/src/plothist/examples/model_ex/model_examples_pull.py +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/src/plothist/examples/model_ex/model_examples_pull_no_model_unc.py +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/src/plothist/examples/model_ex/model_examples_stacked.py +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/src/plothist/examples/model_ex/model_examples_stacked_unstacked.py +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/src/plothist/examples/model_ex/model_examples_unstacked.py +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/src/plothist/examples/model_ex/model_with_stacked_and_unstacked_function_components.py +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/src/plothist/examples/model_ex/model_with_stacked_and_unstacked_histograms_components.py +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/src/plothist/examples/model_ex/ratio_data_vs_model_with_stacked_and_unstacked_function_components.py +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/src/plothist/examples/utility/README.rst +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/src/plothist/examples/utility/add_text_example.py +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/src/plothist/examples/utility/color_palette_hists.py +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/src/plothist/examples/utility/matplotlib_vs_plothist_style.py +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/src/plothist/examples/utility/uncertainty_types.py +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/src/plothist/test_helpers.py +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/tests/test_boost_histogram_version.py +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/tests/test_comparison.py +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/tests/test_comparison_asymmetry.py +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/tests/test_comparison_difference.py +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/tests/test_comparison_efficiency.py +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/tests/test_comparison_pull.py +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/tests/test_comparison_ratio.py +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/tests/test_examples_1d_hist.py +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/tests/test_examples_2d_hist.py +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/tests/test_examples_advanced.py +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/tests/test_examples_data_model.py +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/tests/test_examples_func_1d.py +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/tests/test_examples_utility.py +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/tests/test_fonts.py +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/tests/test_get_data.py +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/tests/test_histogramming.py +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/tests/test_plothist_style.py +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/tests/test_plotters.py +0 -0
- {plothist-1.7.0 → plothist-1.8.0}/tests/test_test_helpers.py +0 -0
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: User Story
|
|
3
3
|
about: This template is for creating user stories.
|
|
4
|
-
title:
|
|
5
|
-
labels:
|
|
6
|
-
assignees:
|
|
7
|
-
|
|
4
|
+
title: ""
|
|
5
|
+
labels: ""
|
|
6
|
+
assignees: ""
|
|
8
7
|
---
|
|
9
8
|
|
|
10
9
|
**As a** [role]
|
|
@@ -12,7 +11,8 @@ assignees: ''
|
|
|
12
11
|
**So that** [benefit]
|
|
13
12
|
|
|
14
13
|
### Details and Assumptions
|
|
15
|
-
|
|
14
|
+
|
|
15
|
+
- [document what you know]
|
|
16
16
|
|
|
17
17
|
### Acceptance Criteria
|
|
18
18
|
|
|
@@ -15,17 +15,15 @@ jobs:
|
|
|
15
15
|
runs-on: ubuntu-latest
|
|
16
16
|
|
|
17
17
|
steps:
|
|
18
|
-
- uses: actions/checkout@
|
|
18
|
+
- uses: actions/checkout@v6
|
|
19
19
|
with:
|
|
20
20
|
persist-credentials: false
|
|
21
21
|
- name: Install uv and set the python version
|
|
22
|
-
uses: astral-sh/setup-uv@
|
|
23
|
-
with:
|
|
24
|
-
version: "0.6.8"
|
|
22
|
+
uses: astral-sh/setup-uv@v7
|
|
25
23
|
- name: Build distribution
|
|
26
24
|
run: uv build
|
|
27
25
|
- name: Store the distribution packages
|
|
28
|
-
uses: actions/upload-artifact@
|
|
26
|
+
uses: actions/upload-artifact@v6
|
|
29
27
|
with:
|
|
30
28
|
name: python-package-distributions
|
|
31
29
|
path: dist/
|
|
@@ -46,7 +44,7 @@ jobs:
|
|
|
46
44
|
|
|
47
45
|
steps:
|
|
48
46
|
- name: Download all the dists
|
|
49
|
-
uses: actions/download-artifact@
|
|
47
|
+
uses: actions/download-artifact@v7
|
|
50
48
|
with:
|
|
51
49
|
name: python-package-distributions
|
|
52
50
|
path: dist/
|
|
@@ -71,7 +69,7 @@ jobs:
|
|
|
71
69
|
|
|
72
70
|
steps:
|
|
73
71
|
- name: Download all the dists
|
|
74
|
-
uses: actions/download-artifact@
|
|
72
|
+
uses: actions/download-artifact@v7
|
|
75
73
|
with:
|
|
76
74
|
name: python-package-distributions
|
|
77
75
|
path: dist/
|
|
@@ -7,37 +7,40 @@ on:
|
|
|
7
7
|
pull_request:
|
|
8
8
|
branches: ["main"]
|
|
9
9
|
|
|
10
|
+
concurrency:
|
|
11
|
+
group: ${{ github.workflow }}-${{ github.ref }}
|
|
12
|
+
cancel-in-progress: true
|
|
13
|
+
|
|
10
14
|
jobs:
|
|
11
15
|
build:
|
|
12
16
|
runs-on: ubuntu-latest
|
|
13
17
|
strategy:
|
|
14
18
|
fail-fast: false
|
|
15
19
|
matrix:
|
|
16
|
-
python-version: ["3.
|
|
20
|
+
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
|
|
17
21
|
|
|
18
22
|
steps:
|
|
19
|
-
- uses: actions/checkout@
|
|
23
|
+
- uses: actions/checkout@v6
|
|
20
24
|
|
|
21
25
|
- name: Install uv and set the python version
|
|
22
|
-
uses: astral-sh/setup-uv@
|
|
26
|
+
uses: astral-sh/setup-uv@v7
|
|
23
27
|
with:
|
|
24
|
-
version: "0.6.8"
|
|
25
28
|
python-version: ${{ matrix.python-version }}
|
|
26
29
|
|
|
27
30
|
- name: Install the project
|
|
28
31
|
run: |
|
|
29
32
|
uv sync --group dev --group test
|
|
30
33
|
|
|
31
|
-
- name: Run
|
|
34
|
+
- name: Run prek
|
|
32
35
|
run: |
|
|
33
|
-
uv run
|
|
36
|
+
uv run prek run --all-files
|
|
34
37
|
|
|
35
38
|
- name: Test with pytest
|
|
36
39
|
run: |
|
|
37
40
|
uv run python -m pytest -r sa --mpl --mpl-results-path=pytest_results -n auto
|
|
38
41
|
|
|
39
42
|
- name: Upload pytest test results
|
|
40
|
-
uses: actions/upload-artifact@
|
|
43
|
+
uses: actions/upload-artifact@v6
|
|
41
44
|
if: failure()
|
|
42
45
|
with:
|
|
43
46
|
name: pytest_results-${{ matrix.python-version }}
|
|
@@ -11,14 +11,12 @@ jobs:
|
|
|
11
11
|
runs-on: ubuntu-latest
|
|
12
12
|
steps:
|
|
13
13
|
- name: Checkout
|
|
14
|
-
uses: actions/checkout@
|
|
14
|
+
uses: actions/checkout@v6
|
|
15
15
|
with:
|
|
16
16
|
fetch-depth: 2
|
|
17
17
|
|
|
18
18
|
- name: Install uv and set the python version
|
|
19
|
-
uses: astral-sh/setup-uv@
|
|
20
|
-
with:
|
|
21
|
-
version: "0.6.8"
|
|
19
|
+
uses: astral-sh/setup-uv@v7
|
|
22
20
|
|
|
23
21
|
- name: Install the project and the test dependencies
|
|
24
22
|
run: uv sync --group test
|
|
@@ -30,9 +30,9 @@ repos:
|
|
|
30
30
|
args: ["--pytest-test-first"]
|
|
31
31
|
|
|
32
32
|
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
33
|
-
rev: v0.
|
|
33
|
+
rev: v0.14.10
|
|
34
34
|
hooks:
|
|
35
|
-
- id: ruff
|
|
35
|
+
- id: ruff-check
|
|
36
36
|
args: ["--fix", "--show-fixes"]
|
|
37
37
|
- id: ruff-format
|
|
38
38
|
|
|
@@ -44,13 +44,13 @@ repos:
|
|
|
44
44
|
- tomli
|
|
45
45
|
|
|
46
46
|
- repo: https://github.com/python-jsonschema/check-jsonschema
|
|
47
|
-
rev: 0.
|
|
47
|
+
rev: 0.36.0
|
|
48
48
|
hooks:
|
|
49
49
|
- id: check-github-workflows
|
|
50
50
|
args: ["--verbose"]
|
|
51
51
|
|
|
52
52
|
- repo: https://github.com/pre-commit/mirrors-mypy
|
|
53
|
-
rev: v1.
|
|
53
|
+
rev: v1.19.1
|
|
54
54
|
hooks:
|
|
55
55
|
- id: mypy
|
|
56
56
|
files: src
|
|
@@ -65,14 +65,24 @@ repos:
|
|
|
65
65
|
- id: rst-directive-colons
|
|
66
66
|
- id: rst-inline-touching-normal
|
|
67
67
|
|
|
68
|
+
- repo: https://github.com/rbubley/mirrors-prettier
|
|
69
|
+
rev: "v3.7.4"
|
|
70
|
+
hooks:
|
|
71
|
+
- id: prettier
|
|
72
|
+
|
|
68
73
|
- repo: https://github.com/python-jsonschema/check-jsonschema
|
|
69
|
-
rev: 0.
|
|
74
|
+
rev: 0.36.0
|
|
70
75
|
hooks:
|
|
71
76
|
- id: check-readthedocs
|
|
72
77
|
- id: check-dependabot
|
|
73
78
|
- id: check-github-workflows
|
|
74
79
|
|
|
75
80
|
- repo: https://github.com/henryiii/validate-pyproject-schema-store
|
|
76
|
-
rev:
|
|
81
|
+
rev: 2026.01.02
|
|
77
82
|
hooks:
|
|
78
83
|
- id: validate-pyproject
|
|
84
|
+
|
|
85
|
+
- repo: https://github.com/scientific-python/cookie
|
|
86
|
+
rev: 2025.11.21
|
|
87
|
+
hooks:
|
|
88
|
+
- id: sp-repo-review
|
|
@@ -4,13 +4,13 @@ type: software
|
|
|
4
4
|
title: "plothist"
|
|
5
5
|
abstract: "Visualize and compare data in a scalable way and a beautiful style."
|
|
6
6
|
authors:
|
|
7
|
-
- family-names: "Praz"
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
- family-names: "Fillinger"
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
7
|
+
- family-names: "Praz"
|
|
8
|
+
given-names: "Cyrille"
|
|
9
|
+
orcid: "https://orcid.org/0000-0002-6154-885X"
|
|
10
|
+
- family-names: "Fillinger"
|
|
11
|
+
given-names: "Tristan"
|
|
12
|
+
affiliation: "High Energy Accelerator Research Organization (KEK), Tsukuba, Japan"
|
|
13
|
+
orcid: "https://orcid.org/0000-0001-9795-7412"
|
|
14
14
|
doi: 10.5281/zenodo.10995667
|
|
15
15
|
repository-code: "https://github.com/cyrraz/plothist/"
|
|
16
16
|
url: " plothist.readthedocs.io/"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
BSD 3-Clause License
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2023-
|
|
3
|
+
Copyright (c) 2023-2026, Cyrille Praz, Tristan Fillinger
|
|
4
4
|
|
|
5
5
|
Redistribution and use in source and binary forms, with or without
|
|
6
6
|
modification, are permitted provided that the following conditions are met:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: plothist
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.8.0
|
|
4
4
|
Summary: Plot histograms in a scalable way and a beautiful style.
|
|
5
5
|
Project-URL: Homepage, https://github.com/cyrraz/plothist
|
|
6
6
|
Project-URL: Documentation, https://plothist.readthedocs.io/
|
|
@@ -14,14 +14,19 @@ Classifier: Intended Audience :: Science/Research
|
|
|
14
14
|
Classifier: License :: OSI Approved :: BSD License
|
|
15
15
|
Classifier: Operating System :: OS Independent
|
|
16
16
|
Classifier: Programming Language :: Python
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
17
23
|
Classifier: Topic :: Scientific/Engineering
|
|
18
|
-
Requires-Python: >=3.
|
|
24
|
+
Requires-Python: >=3.10
|
|
19
25
|
Requires-Dist: boost-histogram>=1.4.0
|
|
20
|
-
Requires-Dist: matplotlib>=3.
|
|
26
|
+
Requires-Dist: matplotlib>=3.10.8
|
|
21
27
|
Requires-Dist: numpy>=1.14.5
|
|
22
28
|
Requires-Dist: plothist-utils>=0.0.1
|
|
23
|
-
Requires-Dist: pyyaml>=
|
|
24
|
-
Requires-Dist: requests>=2.25.0
|
|
29
|
+
Requires-Dist: pyyaml>=6.0.3
|
|
25
30
|
Requires-Dist: scipy>=1.6.0
|
|
26
31
|
Description-Content-Type: text/x-rst
|
|
27
32
|
|
|
@@ -46,9 +51,9 @@ plothist
|
|
|
46
51
|
:width: 320
|
|
47
52
|
|
|
48
53
|
|
|
49
|
-
|GitHub Project| |PyPI version| |Docs from main| |Discussion| |DOI|
|
|
54
|
+
|GitHub Project| |PyPI version| |conda version| |Docs from main| |Discussion| |DOI|
|
|
50
55
|
|
|
51
|
-
|GitHub Actions Status: CI| |GitHub Actions Status: CD| |pre-commit.ci Status| |Code Coverage|
|
|
56
|
+
|GitHub Actions Status: CI| |GitHub Actions Status: CD| |pre-commit.ci Status| |Linter| |Code Coverage|
|
|
52
57
|
|
|
53
58
|
This package is a wrapper around `matplotlib <https://matplotlib.org/>`_.
|
|
54
59
|
|
|
@@ -75,6 +80,8 @@ This package is a wrapper around `matplotlib <https://matplotlib.org/>`_.
|
|
|
75
80
|
:target: https://github.com/cyrraz/plothist
|
|
76
81
|
.. |PyPI version| image:: https://badge.fury.io/py/plothist.svg?style=flat-square
|
|
77
82
|
:target: https://badge.fury.io/py/plothist
|
|
83
|
+
.. |conda version| image:: https://img.shields.io/conda/vn/conda-forge/plothist?style=platic
|
|
84
|
+
:target: https://anaconda.org/conda-forge/plothist
|
|
78
85
|
.. |Docs from main| image:: https://img.shields.io/badge/docs-main-blue.svg?style=platic
|
|
79
86
|
:target: https://plothist.readthedocs.io/en/main/
|
|
80
87
|
.. |Discussion| image:: https://img.shields.io/static/v1?label=Discussions&message=Ask&color=blue&logo=github?style=flat-square
|
|
@@ -19,9 +19,9 @@ plothist
|
|
|
19
19
|
:width: 320
|
|
20
20
|
|
|
21
21
|
|
|
22
|
-
|GitHub Project| |PyPI version| |Docs from main| |Discussion| |DOI|
|
|
22
|
+
|GitHub Project| |PyPI version| |conda version| |Docs from main| |Discussion| |DOI|
|
|
23
23
|
|
|
24
|
-
|GitHub Actions Status: CI| |GitHub Actions Status: CD| |pre-commit.ci Status| |Code Coverage|
|
|
24
|
+
|GitHub Actions Status: CI| |GitHub Actions Status: CD| |pre-commit.ci Status| |Linter| |Code Coverage|
|
|
25
25
|
|
|
26
26
|
This package is a wrapper around `matplotlib <https://matplotlib.org/>`_.
|
|
27
27
|
|
|
@@ -48,6 +48,8 @@ This package is a wrapper around `matplotlib <https://matplotlib.org/>`_.
|
|
|
48
48
|
:target: https://github.com/cyrraz/plothist
|
|
49
49
|
.. |PyPI version| image:: https://badge.fury.io/py/plothist.svg?style=flat-square
|
|
50
50
|
:target: https://badge.fury.io/py/plothist
|
|
51
|
+
.. |conda version| image:: https://img.shields.io/conda/vn/conda-forge/plothist?style=platic
|
|
52
|
+
:target: https://anaconda.org/conda-forge/plothist
|
|
51
53
|
.. |Docs from main| image:: https://img.shields.io/badge/docs-main-blue.svg?style=platic
|
|
52
54
|
:target: https://plothist.readthedocs.io/en/main/
|
|
53
55
|
.. |Discussion| image:: https://img.shields.io/static/v1?label=Discussions&message=Ask&color=blue&logo=github?style=flat-square
|
|
@@ -66,14 +66,14 @@ You can also run specific nox sessions:
|
|
|
66
66
|
Linters and Formatters
|
|
67
67
|
----------------------
|
|
68
68
|
|
|
69
|
-
``plothist`` uses `
|
|
69
|
+
``plothist`` uses `prek <https://prek.j178.dev/>`_ to manage linters and formatters.
|
|
70
70
|
|
|
71
71
|
The tools are listed in ``.pre-commit-config.yaml``. Key among them is ``Ruff`` is used for linting and formatting, with its configuration in ``pyproject.toml``.
|
|
72
72
|
|
|
73
73
|
Use ``nox -s lint`` to run the linters and formatters.
|
|
74
74
|
|
|
75
|
-
To install the
|
|
75
|
+
To install the hooks, run the following command (assuming you have installed ``plothist`` via ``uv`` following the instructions in :ref:`install-dev-version`):
|
|
76
76
|
|
|
77
77
|
.. code-block:: console
|
|
78
78
|
|
|
79
|
-
uv run
|
|
79
|
+
uv run prek install
|
|
@@ -21,7 +21,7 @@ import plothist
|
|
|
21
21
|
# -- Project information -----------------------------------------------------
|
|
22
22
|
|
|
23
23
|
project = "plothist"
|
|
24
|
-
copyright = "2023-
|
|
24
|
+
copyright = "2023-2026, Cyrille Praz, Tristan Fillinger"
|
|
25
25
|
author = "Cyrille Praz, Tristan Fillinger"
|
|
26
26
|
|
|
27
27
|
parts = plothist.__version__.split(".")
|
|
@@ -7,7 +7,7 @@ Installation and update
|
|
|
7
7
|
Prerequisite
|
|
8
8
|
============
|
|
9
9
|
|
|
10
|
-
You need version 3.
|
|
10
|
+
You need version 3.10 (or a more recent version) of Python 3. You can check your version of Python 3 with:
|
|
11
11
|
|
|
12
12
|
.. code-block:: bash
|
|
13
13
|
|
|
@@ -1,26 +1,33 @@
|
|
|
1
|
+
#!/usr/bin/env -S uv run --script
|
|
2
|
+
|
|
3
|
+
# /// script
|
|
4
|
+
# dependencies = ["nox>=2025.11.12"]
|
|
5
|
+
# ///
|
|
6
|
+
|
|
7
|
+
"""Nox runner."""
|
|
8
|
+
|
|
1
9
|
from __future__ import annotations
|
|
2
10
|
|
|
3
11
|
import argparse
|
|
4
12
|
|
|
5
13
|
import nox
|
|
6
14
|
|
|
7
|
-
nox.
|
|
8
|
-
nox.needs_version = ">=2025.2.9"
|
|
15
|
+
nox.needs_version = ">=2025.11.12"
|
|
9
16
|
nox.options.default_venv_backend = "uv|venv"
|
|
10
17
|
|
|
11
|
-
PYTHON_ALL_VERSIONS = ["3.
|
|
18
|
+
PYTHON_ALL_VERSIONS = ["3.10", "3.14"]
|
|
12
19
|
|
|
13
20
|
|
|
14
|
-
@nox.session(reuse_venv=True)
|
|
21
|
+
@nox.session(reuse_venv=True, default=True)
|
|
15
22
|
def lint(session: nox.Session) -> None:
|
|
16
23
|
"""
|
|
17
24
|
Run the linter.
|
|
18
25
|
"""
|
|
19
|
-
session.install("
|
|
20
|
-
session.run("
|
|
26
|
+
session.install("prek")
|
|
27
|
+
session.run("prek", "run", "--all-files", *session.posargs)
|
|
21
28
|
|
|
22
29
|
|
|
23
|
-
@nox.session(python=PYTHON_ALL_VERSIONS, reuse_venv=True)
|
|
30
|
+
@nox.session(python=PYTHON_ALL_VERSIONS, reuse_venv=True, default=True)
|
|
24
31
|
def tests(session: nox.Session) -> None:
|
|
25
32
|
"""
|
|
26
33
|
Run the unit and regular tests.
|
|
@@ -31,7 +38,7 @@ def tests(session: nox.Session) -> None:
|
|
|
31
38
|
session.run("pytest", "--mpl", "-n", "auto", *session.posargs)
|
|
32
39
|
|
|
33
40
|
|
|
34
|
-
@nox.session(reuse_venv=True)
|
|
41
|
+
@nox.session(reuse_venv=True, default=False)
|
|
35
42
|
def generate_examples_figures(session: nox.Session) -> None:
|
|
36
43
|
"""
|
|
37
44
|
Generate the example figures. Pass "-- tests/test_examples_*.py" to run only the relevant tests.
|
|
@@ -47,7 +54,7 @@ def generate_examples_figures(session: nox.Session) -> None:
|
|
|
47
54
|
|
|
48
55
|
|
|
49
56
|
# run coverage
|
|
50
|
-
@nox.session(reuse_venv=True)
|
|
57
|
+
@nox.session(reuse_venv=True, default=False)
|
|
51
58
|
def coverage(session: nox.Session) -> None:
|
|
52
59
|
"""
|
|
53
60
|
Run the unit tests with coverage. Warning: takes a long time to run.
|
|
@@ -62,7 +69,7 @@ def coverage(session: nox.Session) -> None:
|
|
|
62
69
|
)
|
|
63
70
|
|
|
64
71
|
|
|
65
|
-
@nox.session(reuse_venv=True)
|
|
72
|
+
@nox.session(reuse_venv=True, default=False)
|
|
66
73
|
def docs(session: nox.Session) -> None:
|
|
67
74
|
"""
|
|
68
75
|
Build the docs. Pass --non-interactive to avoid serving. Pass "-- -b linkcheck" to check links.
|
|
@@ -95,3 +102,7 @@ def docs(session: nox.Session) -> None:
|
|
|
95
102
|
)
|
|
96
103
|
else:
|
|
97
104
|
session.run("sphinx-build", "--keep-going", *shared_args)
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
if __name__ == "__main__":
|
|
108
|
+
nox.main()
|
|
@@ -16,17 +16,22 @@ classifiers = [
|
|
|
16
16
|
"Intended Audience :: Science/Research",
|
|
17
17
|
"License :: OSI Approved :: BSD License",
|
|
18
18
|
"Operating System :: OS Independent",
|
|
19
|
+
"Programming Language :: Python :: 3",
|
|
20
|
+
"Programming Language :: Python :: 3.10",
|
|
21
|
+
"Programming Language :: Python :: 3.11",
|
|
22
|
+
"Programming Language :: Python :: 3.12",
|
|
23
|
+
"Programming Language :: Python :: 3.13",
|
|
24
|
+
"Programming Language :: Python :: 3.14",
|
|
19
25
|
"Programming Language :: Python",
|
|
20
26
|
"Topic :: Scientific/Engineering",
|
|
21
27
|
]
|
|
22
|
-
requires-python = ">=3.
|
|
28
|
+
requires-python = ">=3.10"
|
|
23
29
|
dependencies = [
|
|
24
30
|
"boost-histogram>=1.4.0",
|
|
25
31
|
"numpy>=1.14.5",
|
|
26
|
-
"matplotlib>=3.
|
|
27
|
-
"pyyaml>=
|
|
32
|
+
"matplotlib>=3.10.8",
|
|
33
|
+
"pyyaml>=6.0.3",
|
|
28
34
|
"scipy>=1.6.0",
|
|
29
|
-
"requests>=2.25.0",
|
|
30
35
|
"plothist_utils>=0.0.1",
|
|
31
36
|
]
|
|
32
37
|
dynamic = ["version"]
|
|
@@ -43,12 +48,12 @@ write-changes = true
|
|
|
43
48
|
|
|
44
49
|
[dependency-groups]
|
|
45
50
|
dev = [
|
|
46
|
-
"
|
|
51
|
+
"prek>=0.1.1",
|
|
47
52
|
]
|
|
48
53
|
test = [
|
|
49
|
-
"pytest>=
|
|
50
|
-
"pytest-cov>=
|
|
51
|
-
"pytest-mpl>=0.
|
|
54
|
+
"pytest>=9",
|
|
55
|
+
"pytest-cov>=7",
|
|
56
|
+
"pytest-mpl>=0.18.0",
|
|
52
57
|
"pytest-github-actions-annotate-failures>=0.3.0",
|
|
53
58
|
"pytest-xdist>=3.8.0",
|
|
54
59
|
]
|
|
@@ -59,6 +64,28 @@ docs = [
|
|
|
59
64
|
]
|
|
60
65
|
|
|
61
66
|
|
|
67
|
+
[tool.pytest]
|
|
68
|
+
minversion = "9.0"
|
|
69
|
+
addopts = ["-ra", "--showlocals"]
|
|
70
|
+
strict = true
|
|
71
|
+
filterwarnings = [
|
|
72
|
+
"error",
|
|
73
|
+
]
|
|
74
|
+
log_level = "INFO"
|
|
75
|
+
testpaths = [
|
|
76
|
+
"tests",
|
|
77
|
+
]
|
|
78
|
+
|
|
79
|
+
[tool.mypy]
|
|
80
|
+
files = ["src", "tests"]
|
|
81
|
+
python_version = "3.10"
|
|
82
|
+
warn_unused_configs = true
|
|
83
|
+
strict = true
|
|
84
|
+
enable_error_code = ["ignore-without-code", "redundant-expr", "truthy-bool"]
|
|
85
|
+
warn_unreachable = true
|
|
86
|
+
disallow_untyped_defs = false
|
|
87
|
+
disallow_incomplete_defs = false
|
|
88
|
+
|
|
62
89
|
[tool.hatch]
|
|
63
90
|
version.source = "vcs"
|
|
64
91
|
build.hooks.vcs.version-file = "src/plothist/_version.py"
|
|
@@ -28,7 +28,7 @@ version_tuple: VERSION_TUPLE
|
|
|
28
28
|
commit_id: COMMIT_ID
|
|
29
29
|
__commit_id__: COMMIT_ID
|
|
30
30
|
|
|
31
|
-
__version__ = version = '1.
|
|
32
|
-
__version_tuple__ = version_tuple = (1,
|
|
31
|
+
__version__ = version = '1.8.0'
|
|
32
|
+
__version_tuple__ = version_tuple = (1, 8, 0)
|
|
33
33
|
|
|
34
34
|
__commit_id__ = commit_id = None
|
|
@@ -49,7 +49,7 @@ def _is_unweighted(hist: bh.Histogram) -> bool:
|
|
|
49
49
|
bool
|
|
50
50
|
True if the histogram is unweighted, False otherwise.
|
|
51
51
|
"""
|
|
52
|
-
return np.allclose(hist.variances(), hist.values(), equal_nan=True)
|
|
52
|
+
return bool(np.allclose(hist.variances(), hist.values(), equal_nan=True))
|
|
53
53
|
|
|
54
54
|
|
|
55
55
|
def get_asymmetrical_uncertainties(
|
{plothist-1.7.0 → plothist-1.8.0}/src/plothist/examples/advanced/1d_side_by_side_with_numbers.py
RENAMED
|
@@ -42,7 +42,7 @@ plot_hist(histos, ax=ax, label=labels, color=colors)
|
|
|
42
42
|
|
|
43
43
|
# Add the number of entries on top of each bar
|
|
44
44
|
# Get the correct shift in x-axis for each bar
|
|
45
|
-
def calculate_shifts(width, n_bars):
|
|
45
|
+
def calculate_shifts(width: float, n_bars: int) -> np.ndarray:
|
|
46
46
|
half_width = width / 2
|
|
47
47
|
shift = np.linspace(-half_width, half_width, n_bars, endpoint=False)
|
|
48
48
|
shift += width / (2 * n_bars)
|
{plothist-1.7.0 → plothist-1.8.0}/src/plothist/examples/advanced/asymmetry_comparison_advanced.py
RENAMED
|
@@ -11,6 +11,7 @@ from plothist_utils import get_dummy_data
|
|
|
11
11
|
df = get_dummy_data()
|
|
12
12
|
|
|
13
13
|
###
|
|
14
|
+
import numpy as np
|
|
14
15
|
from scipy.stats import norm
|
|
15
16
|
|
|
16
17
|
from plothist import (
|
|
@@ -25,11 +26,11 @@ from plothist import (
|
|
|
25
26
|
|
|
26
27
|
|
|
27
28
|
# Define some random functions that will be used as Data fit functions
|
|
28
|
-
def f1(x):
|
|
29
|
+
def f1(x: np.ndarray) -> np.ndarray:
|
|
29
30
|
return 4000 * norm.pdf(x, loc=-0.5, scale=1.6)
|
|
30
31
|
|
|
31
32
|
|
|
32
|
-
def f2(x):
|
|
33
|
+
def f2(x: np.ndarray) -> np.ndarray:
|
|
33
34
|
return 4000 * norm.pdf(x, loc=0.5, scale=1.6)
|
|
34
35
|
|
|
35
36
|
|
|
@@ -13,16 +13,21 @@ from matplotlib import patches
|
|
|
13
13
|
from plothist import get_color_palette
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
def create_palette_plot(
|
|
16
|
+
def create_palette_plot(
|
|
17
|
+
colors: list[str] | list[tuple[float, float, float]],
|
|
18
|
+
fig_name: str,
|
|
19
|
+
add_text: bool = False,
|
|
20
|
+
add_black_border: bool = False,
|
|
21
|
+
):
|
|
17
22
|
ncolors = len(colors)
|
|
18
23
|
|
|
19
24
|
# Create a figure and axis
|
|
20
25
|
fig, ax = plt.subplots(figsize=(ncolors, 1))
|
|
21
26
|
|
|
22
27
|
# Plot the colored squares with small spacing
|
|
23
|
-
square_size = 1
|
|
28
|
+
square_size = 1.0
|
|
24
29
|
spacing = 0.1
|
|
25
|
-
x = 0
|
|
30
|
+
x = 0.0
|
|
26
31
|
|
|
27
32
|
for color in colors:
|
|
28
33
|
rect = patches.Rectangle((x, 0), square_size, square_size, color=color)
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
|
+
from collections.abc import Callable
|
|
4
|
+
|
|
3
5
|
import matplotlib as mpl
|
|
4
6
|
import matplotlib.pyplot as plt
|
|
5
7
|
import numpy as np
|
|
@@ -82,9 +84,9 @@ def cubehelix_palette(
|
|
|
82
84
|
p. 289-295.
|
|
83
85
|
"""
|
|
84
86
|
|
|
85
|
-
def f(x0, x1):
|
|
87
|
+
def f(x0: float, x1: float) -> Callable[[float], np.ndarray]:
|
|
86
88
|
# Adapted from matplotlib
|
|
87
|
-
def color(lambda_):
|
|
89
|
+
def color(lambda_: float) -> np.ndarray:
|
|
88
90
|
# emphasise either low intensity values (gamma < 1),
|
|
89
91
|
# or high intensity values (gamma > 1)
|
|
90
92
|
lambda_gamma = lambda_**gamma
|
|
@@ -187,27 +189,36 @@ def set_fitting_ylabel_fontsize(ax: plt.Axes) -> float:
|
|
|
187
189
|
float
|
|
188
190
|
The adjusted font size for the ylabel text.
|
|
189
191
|
"""
|
|
190
|
-
ylabel_fontsize = ax.yaxis.get_label().get_fontsize()
|
|
192
|
+
ylabel_fontsize = float(ax.yaxis.get_label().get_fontsize())
|
|
191
193
|
|
|
192
194
|
# Force renderer to be initialized
|
|
193
195
|
ax.figure.canvas.draw()
|
|
194
196
|
|
|
195
|
-
|
|
197
|
+
current_extent = (
|
|
196
198
|
ax.yaxis.get_label()
|
|
197
199
|
.get_window_extent(renderer=ax.figure.canvas.get_renderer())
|
|
198
200
|
.transformed(ax.transData.inverted())
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
201
|
+
)
|
|
202
|
+
|
|
203
|
+
y_alignment = plt.rcParams["yaxis.labellocation"]
|
|
204
|
+
|
|
205
|
+
while (
|
|
206
|
+
y_alignment in ["center", "bottom"] and current_extent.y1 > ax.get_ylim()[1]
|
|
207
|
+
) or (y_alignment == "top" and current_extent.y0 < ax.get_ylim()[0]):
|
|
202
208
|
ylabel_fontsize -= 0.1
|
|
203
209
|
|
|
204
210
|
if ylabel_fontsize <= 0:
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
)
|
|
211
|
+
msg = "Only a y-label with a negative font size would fit on the y-axis."
|
|
212
|
+
raise ValueError(msg)
|
|
208
213
|
|
|
209
214
|
ax.get_yaxis().get_label().set_size(ylabel_fontsize)
|
|
210
215
|
|
|
216
|
+
current_extent = (
|
|
217
|
+
ax.yaxis.get_label()
|
|
218
|
+
.get_window_extent(renderer=ax.figure.canvas.get_renderer())
|
|
219
|
+
.transformed(ax.transData.inverted())
|
|
220
|
+
)
|
|
221
|
+
|
|
211
222
|
return ylabel_fontsize
|
|
212
223
|
|
|
213
224
|
|
|
@@ -237,7 +248,7 @@ def add_text(
|
|
|
237
248
|
Draw a white rectangle under the text, by default False.
|
|
238
249
|
ax : matplotlib.axes.Axes, optional
|
|
239
250
|
Figure axis, by default None.
|
|
240
|
-
kwargs : dict
|
|
251
|
+
kwargs : dict[str, Any]
|
|
241
252
|
Keyword arguments to be passed to the ax.text() function.
|
|
242
253
|
In particular, the keyword arguments ha and va, which are set by default to accommodate to the x and y aliases, can be used to change the text alignment.
|
|
243
254
|
|
|
@@ -341,7 +352,7 @@ def add_luminosity(
|
|
|
341
352
|
Draw a white rectangle under the text, by default False.
|
|
342
353
|
ax : matplotlib.axes.Axes, optional
|
|
343
354
|
Figure axis, by default None.
|
|
344
|
-
kwargs : dict
|
|
355
|
+
kwargs : dict[str, Any]
|
|
345
356
|
Keyword arguments to be passed to the ax.text() function.
|
|
346
357
|
In particular, the keyword arguments ha and va, which are set to "left" (or "right" if x="right") and "bottom" by default, can be used to change the text alignment.
|
|
347
358
|
|
|
@@ -393,7 +404,7 @@ def plot_reordered_legend(ax: plt.Axes, order: list[int], **kwargs) -> None:
|
|
|
393
404
|
order : list[int]
|
|
394
405
|
A list of integers specifying the new order of the legend items.
|
|
395
406
|
The integers refer to the indices of the current legend items.
|
|
396
|
-
kwargs : dict, optional
|
|
407
|
+
kwargs : dict[str, Any], optional
|
|
397
408
|
Keyword arguments to be passed to the ax.legend() function, such as the legend location (loc).
|
|
398
409
|
|
|
399
410
|
Returns
|