plothist 1.4.0__tar.gz → 1.5.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.4.0 → plothist-1.5.0}/.github/workflows/cd.yaml +1 -1
- {plothist-1.4.0 → plothist-1.5.0}/.github/workflows/ci.yaml +12 -3
- {plothist-1.4.0 → plothist-1.5.0}/.github/workflows/coverage.yaml +1 -1
- {plothist-1.4.0 → plothist-1.5.0}/.gitignore +3 -0
- {plothist-1.4.0 → plothist-1.5.0}/.pre-commit-config.yaml +5 -5
- {plothist-1.4.0 → plothist-1.5.0}/PKG-INFO +1 -1
- {plothist-1.4.0 → plothist-1.5.0}/docs/CONTRIBUTING.rst +2 -0
- {plothist-1.4.0 → plothist-1.5.0}/docs/advanced/model_examples.rst +21 -21
- {plothist-1.4.0 → plothist-1.5.0}/docs/advanced/other_advanced.rst +8 -8
- {plothist-1.4.0 → plothist-1.5.0}/docs/basics/1d_func.rst +5 -5
- {plothist-1.4.0 → plothist-1.5.0}/docs/basics/1d_hist.rst +32 -32
- {plothist-1.4.0 → plothist-1.5.0}/docs/basics/2d_hist.rst +12 -12
- {plothist-1.4.0 → plothist-1.5.0}/docs/conf.py +9 -7
- plothist-1.5.0/docs/img/1d_comparison_advanced.png +0 -0
- plothist-1.5.0/docs/img/1d_comparison_asymmetry.png +0 -0
- plothist-1.5.0/docs/img/1d_comparison_difference.png +0 -0
- plothist-1.5.0/docs/img/1d_comparison_efficiency.png +0 -0
- plothist-1.5.0/docs/img/1d_comparison_only_efficiency.png +0 -0
- plothist-1.5.0/docs/img/1d_comparison_pull.png +0 -0
- plothist-1.5.0/docs/img/1d_comparison_ratio.png +0 -0
- plothist-1.5.0/docs/img/1d_comparison_relative_difference.png +0 -0
- plothist-1.5.0/docs/img/1d_comparison_split_ratio.png +0 -0
- plothist-1.5.0/docs/img/1d_elt1.png +0 -0
- plothist-1.5.0/docs/img/1d_elt1_stacked.png +0 -0
- plothist-1.5.0/docs/img/1d_elt2.png +0 -0
- plothist-1.5.0/docs/img/1d_hist_simple.png +0 -0
- plothist-1.5.0/docs/img/1d_int_category.png +0 -0
- plothist-1.5.0/docs/img/1d_profile.png +0 -0
- plothist-1.5.0/docs/img/1d_side_by_side.png +0 -0
- plothist-1.5.0/docs/img/1d_side_by_side_with_numbers.png +0 -0
- plothist-1.5.0/docs/img/1d_str_category.png +0 -0
- plothist-1.5.0/docs/img/2d_hist_correlations_0.png +0 -0
- plothist-1.5.0/docs/img/2d_hist_correlations_1.png +0 -0
- plothist-1.5.0/docs/img/2d_hist_correlations_2.png +0 -0
- plothist-1.5.0/docs/img/2d_hist_simple.png +0 -0
- plothist-1.5.0/docs/img/2d_hist_simple_discrete_colormap.png +0 -0
- plothist-1.5.0/docs/img/2d_hist_uneven.png +0 -0
- plothist-1.5.0/docs/img/2d_hist_with_projections.png +0 -0
- plothist-1.5.0/docs/img/add_text_example.png +0 -0
- plothist-1.5.0/docs/img/asymmetry_comparison_advanced.png +0 -0
- plothist-1.5.0/docs/img/color_palette_hists.png +0 -0
- plothist-1.5.0/docs/img/fct_1d.png +0 -0
- plothist-1.5.0/docs/img/fct_1d_stacked.png +0 -0
- plothist-1.5.0/docs/img/matplotlib_example.png +0 -0
- plothist-1.5.0/docs/img/model_all_comparisons.png +0 -0
- plothist-1.5.0/docs/img/model_all_comparisons_no_model_unc.png +0 -0
- plothist-1.5.0/docs/img/model_examples_flatten2D.png +0 -0
- plothist-1.5.0/docs/img/model_examples_pull.png +0 -0
- plothist-1.5.0/docs/img/model_examples_pull_no_model_unc.png +0 -0
- plothist-1.5.0/docs/img/model_examples_stacked.png +0 -0
- plothist-1.5.0/docs/img/model_examples_stacked_unstacked.png +0 -0
- plothist-1.5.0/docs/img/model_examples_unstacked.png +0 -0
- plothist-1.5.0/docs/img/model_with_stacked_and_unstacked_function_components.png +0 -0
- plothist-1.5.0/docs/img/model_with_stacked_and_unstacked_histograms_components.png +0 -0
- plothist-1.5.0/docs/img/plothist_example.png +0 -0
- plothist-1.5.0/docs/img/ratio_data_vs_model_with_stacked_and_unstacked_function_components.png +0 -0
- plothist-1.5.0/docs/img/usage_YlGnBu_r_palette.png +0 -0
- plothist-1.5.0/docs/img/usage_coolwarm_palette.png +0 -0
- plothist-1.5.0/docs/img/usage_cubehelix.png +0 -0
- plothist-1.5.0/docs/img/usage_style_cycle.png +0 -0
- plothist-1.5.0/docs/img/usage_viridis_palette.png +0 -0
- {plothist-1.4.0 → plothist-1.5.0}/docs/index.rst +1 -1
- {plothist-1.4.0 → plothist-1.5.0}/docs/usage/plot_fitting_results.rst +1 -1
- {plothist-1.4.0 → plothist-1.5.0}/docs/usage/style.rst +8 -8
- {plothist-1.4.0 → plothist-1.5.0}/docs/usage/utilities.rst +3 -3
- {plothist-1.4.0 → plothist-1.5.0}/noxfile.py +17 -2
- {plothist-1.4.0 → plothist-1.5.0}/pyproject.toml +3 -3
- {plothist-1.4.0 → plothist-1.5.0}/src/plothist/_version.py +2 -2
- {plothist-1.4.0 → plothist-1.5.0}/src/plothist/comparison.py +111 -105
- {plothist-1.4.0/docs → plothist-1.5.0/src/plothist}/examples/1d_hist/1d_comparison_asymmetry.py +2 -2
- {plothist-1.4.0/docs → plothist-1.5.0/src/plothist}/examples/1d_hist/1d_comparison_difference.py +2 -2
- {plothist-1.4.0/docs → plothist-1.5.0/src/plothist}/examples/1d_hist/1d_comparison_efficiency.py +2 -2
- {plothist-1.4.0/docs → plothist-1.5.0/src/plothist}/examples/1d_hist/1d_comparison_pull.py +2 -2
- {plothist-1.4.0/docs → plothist-1.5.0/src/plothist}/examples/1d_hist/1d_comparison_relative_difference.py +2 -2
- {plothist-1.4.0/docs → plothist-1.5.0/src/plothist}/examples/1d_hist/1d_comparison_split_ratio.py +2 -2
- {plothist-1.4.0/docs → plothist-1.5.0/src/plothist}/examples/1d_hist/1d_elt1_stacked.py +7 -7
- {plothist-1.4.0/docs → plothist-1.5.0/src/plothist}/examples/2d_hist/2d_hist_correlations.py +22 -6
- {plothist-1.4.0/docs → plothist-1.5.0/src/plothist}/examples/2d_hist/2d_hist_simple.py +1 -1
- {plothist-1.4.0/docs → plothist-1.5.0/src/plothist}/examples/2d_hist/2d_hist_simple_discrete_colormap.py +1 -1
- {plothist-1.4.0/docs → plothist-1.5.0/src/plothist}/examples/2d_hist/2d_hist_with_projections.py +1 -1
- {plothist-1.4.0/docs → plothist-1.5.0/src/plothist}/examples/advanced/1d_comparison_advanced.py +1 -1
- {plothist-1.4.0/docs → plothist-1.5.0/src/plothist}/examples/advanced/1d_side_by_side_with_numbers.py +2 -3
- {plothist-1.4.0/docs → plothist-1.5.0/src/plothist}/examples/advanced/asymmetry_comparison_advanced.py +7 -3
- {plothist-1.4.0/docs → plothist-1.5.0/src/plothist}/examples/advanced/model_examples_flatten2D.py +9 -39
- plothist-1.4.0/docs/examples/1d_func/1d_fct.py → plothist-1.5.0/src/plothist/examples/func_1d/fct_1d.py +2 -2
- plothist-1.4.0/docs/examples/1d_func/1d_fct_stacked.py → plothist-1.5.0/src/plothist/examples/func_1d/fct_1d_stacked.py +2 -2
- {plothist-1.4.0/docs → plothist-1.5.0/src/plothist}/examples/model_ex/model_all_comparisons.py +6 -8
- {plothist-1.4.0/docs → plothist-1.5.0/src/plothist}/examples/model_ex/model_all_comparisons_no_model_unc.py +6 -8
- {plothist-1.4.0/docs → plothist-1.5.0/src/plothist}/examples/model_ex/model_examples_pull.py +2 -6
- {plothist-1.4.0/docs → plothist-1.5.0/src/plothist}/examples/model_ex/model_examples_pull_no_model_unc.py +3 -7
- {plothist-1.4.0/docs → plothist-1.5.0/src/plothist}/examples/model_ex/model_examples_stacked.py +1 -1
- {plothist-1.4.0/docs → plothist-1.5.0/src/plothist}/examples/model_ex/model_examples_stacked_unstacked.py +1 -5
- {plothist-1.4.0/docs → plothist-1.5.0/src/plothist}/examples/model_ex/model_examples_unstacked.py +1 -5
- {plothist-1.4.0/docs → plothist-1.5.0/src/plothist}/examples/model_ex/model_with_stacked_and_unstacked_function_components.py +1 -8
- {plothist-1.4.0/docs → plothist-1.5.0/src/plothist}/examples/model_ex/model_with_stacked_and_unstacked_histograms_components.py +3 -2
- {plothist-1.4.0/docs → plothist-1.5.0/src/plothist}/examples/model_ex/ratio_data_vs_model_with_stacked_and_unstacked_function_components.py +1 -1
- {plothist-1.4.0/docs → plothist-1.5.0/src/plothist}/examples/utility/add_text_example.py +2 -2
- {plothist-1.4.0/docs → plothist-1.5.0/src/plothist}/examples/utility/color_palette_hists.py +4 -4
- {plothist-1.4.0/docs → plothist-1.5.0/src/plothist}/examples/utility/color_palette_squares.py +9 -3
- {plothist-1.4.0/docs → plothist-1.5.0/src/plothist}/examples/utility/matplotlib_vs_plothist_style.py +8 -1
- {plothist-1.4.0 → plothist-1.5.0}/src/plothist/histogramming.py +60 -39
- {plothist-1.4.0 → plothist-1.5.0}/src/plothist/plothist_style.py +54 -57
- {plothist-1.4.0 → plothist-1.5.0}/src/plothist/plotters.py +207 -194
- plothist-1.5.0/src/plothist/test_helpers.py +43 -0
- {plothist-1.4.0 → plothist-1.5.0}/src/plothist/variable_registry.py +46 -30
- plothist-1.5.0/tests/test_boost_histogram_version.py +16 -0
- plothist-1.5.0/tests/test_comparison.py +37 -0
- plothist-1.4.0/tests/test_asymmetry.py → plothist-1.5.0/tests/test_comparison_asymmetry.py +27 -9
- plothist-1.4.0/tests/test_difference.py → plothist-1.5.0/tests/test_comparison_difference.py +17 -17
- plothist-1.4.0/tests/test_efficiency.py → plothist-1.5.0/tests/test_comparison_efficiency.py +55 -23
- plothist-1.4.0/tests/test_pull.py → plothist-1.5.0/tests/test_comparison_pull.py +17 -17
- plothist-1.4.0/tests/test_ratio.py → plothist-1.5.0/tests/test_comparison_ratio.py +46 -32
- plothist-1.5.0/tests/test_examples_1d_hist.py +39 -0
- plothist-1.5.0/tests/test_examples_2d_hist.py +66 -0
- plothist-1.5.0/tests/test_examples_advanced.py +39 -0
- plothist-1.5.0/tests/test_examples_data_model.py +39 -0
- plothist-1.5.0/tests/test_examples_func_1d.py +39 -0
- plothist-1.5.0/tests/test_examples_utility.py +99 -0
- {plothist-1.4.0 → plothist-1.5.0}/tests/test_fonts.py +1 -1
- {plothist-1.4.0 → plothist-1.5.0}/tests/test_get_data.py +1 -1
- plothist-1.5.0/tests/test_histogramming.py +267 -0
- plothist-1.5.0/tests/test_plothist_style.py +130 -0
- plothist-1.5.0/tests/test_plotters.py +289 -0
- plothist-1.5.0/tests/test_test_helpers.py +15 -0
- {plothist-1.4.0 → plothist-1.5.0}/tests/test_variable_registry.py +103 -46
- {plothist-1.4.0 → plothist-1.5.0}/uv.lock +663 -509
- plothist-1.4.0/docs/img/1d_comparison_asymmetry.svg +0 -1682
- plothist-1.4.0/docs/img/1d_comparison_difference.svg +0 -2090
- plothist-1.4.0/docs/img/1d_comparison_efficiency.svg +0 -2230
- plothist-1.4.0/docs/img/1d_comparison_only_efficiency.svg +0 -1340
- plothist-1.4.0/docs/img/1d_comparison_pull.svg +0 -1718
- plothist-1.4.0/docs/img/1d_comparison_ratio.svg +0 -1598
- plothist-1.4.0/docs/img/1d_comparison_relative_difference.svg +0 -1713
- plothist-1.4.0/docs/img/1d_comparison_split_ratio.svg +0 -2119
- plothist-1.4.0/docs/img/1d_elt1.svg +0 -1119
- plothist-1.4.0/docs/img/1d_elt1_stacked.svg +0 -1454
- plothist-1.4.0/docs/img/1d_elt2.svg +0 -1107
- plothist-1.4.0/docs/img/1d_fct.svg +0 -862
- plothist-1.4.0/docs/img/1d_fct_stacked.svg +0 -4786
- plothist-1.4.0/docs/img/1d_hist_simple.svg +0 -1468
- plothist-1.4.0/docs/img/1d_int_category.svg +0 -773
- plothist-1.4.0/docs/img/1d_profile.svg +0 -953
- plothist-1.4.0/docs/img/1d_side_by_side.svg +0 -835
- plothist-1.4.0/docs/img/1d_side_by_side_with_numbers.svg +0 -1085
- plothist-1.4.0/docs/img/1d_str_category.svg +0 -799
- plothist-1.4.0/docs/img/2d_hist_correlations_0.svg +0 -16339
- plothist-1.4.0/docs/img/2d_hist_correlations_1.svg +0 -16320
- plothist-1.4.0/docs/img/2d_hist_correlations_2.svg +0 -16243
- plothist-1.4.0/docs/img/2d_hist_simple.svg +0 -1892
- plothist-1.4.0/docs/img/2d_hist_simple_discrete_colormap.svg +0 -16295
- plothist-1.4.0/docs/img/2d_hist_uneven.svg +0 -1514
- plothist-1.4.0/docs/img/add_text_example.svg +0 -1929
- plothist-1.4.0/docs/img/asymmetry_comparison_advanced.svg +0 -3104
- plothist-1.4.0/docs/img/matplotlib_example.svg +0 -1249
- plothist-1.4.0/docs/img/model_all_comparisons.svg +0 -6047
- plothist-1.4.0/docs/img/model_all_comparisons_no_model_unc.svg +0 -5627
- plothist-1.4.0/docs/img/model_examples_flatten2D.svg +0 -2229
- plothist-1.4.0/docs/img/model_examples_pull.svg +0 -3210
- plothist-1.4.0/docs/img/model_examples_pull_no_model_unc.svg +0 -3291
- plothist-1.4.0/docs/img/model_examples_stacked_unstacked.svg +0 -3432
- plothist-1.4.0/docs/img/model_examples_unstacked.svg +0 -3373
- plothist-1.4.0/docs/img/model_with_stacked_and_unstacked_function_components.svg +0 -5458
- plothist-1.4.0/docs/img/model_with_stacked_and_unstacked_histograms_components.svg +0 -2674
- plothist-1.4.0/docs/img/plothist_example.svg +0 -1569
- plothist-1.4.0/docs/img/ratio_data_vs_model_with_stacked_and_unstacked_function_components.svg +0 -6174
- plothist-1.4.0/docs/img/usage_YlGnBu_r_palette.svg +0 -92
- plothist-1.4.0/docs/img/usage_colorpalette_examples.svg +0 -9070
- plothist-1.4.0/docs/img/usage_coolwarm_palette.svg +0 -92
- plothist-1.4.0/docs/img/usage_cubehelix.svg +0 -92
- plothist-1.4.0/docs/img/usage_style_cycle.svg +0 -595
- plothist-1.4.0/docs/img/usage_viridis_palette.svg +0 -92
- plothist-1.4.0/src/plothist/scripts/__init__.py +0 -3
- plothist-1.4.0/src/plothist/scripts/make_examples.py +0 -209
- plothist-1.4.0/tests/test_histogramming.py +0 -126
- plothist-1.4.0/tests/test_make_examples.py +0 -11
- {plothist-1.4.0 → plothist-1.5.0}/.github/ISSUE_TEMPLATE/user-story.md +0 -0
- {plothist-1.4.0 → plothist-1.5.0}/.github/dependabot.yaml +0 -0
- {plothist-1.4.0 → plothist-1.5.0}/.github/release.yaml +0 -0
- {plothist-1.4.0 → plothist-1.5.0}/.github/workflows/pr.yaml +0 -0
- {plothist-1.4.0 → plothist-1.5.0}/.readthedocs.yaml +0 -0
- {plothist-1.4.0 → plothist-1.5.0}/AUTHORS.md +0 -0
- {plothist-1.4.0 → plothist-1.5.0}/CITATION.cff +0 -0
- {plothist-1.4.0 → plothist-1.5.0}/LICENSE +0 -0
- {plothist-1.4.0 → plothist-1.5.0}/README.rst +0 -0
- {plothist-1.4.0 → plothist-1.5.0}/codecov.yml +0 -0
- {plothist-1.4.0 → plothist-1.5.0}/docs/basics/variable_registry.rst +0 -0
- {plothist-1.4.0 → plothist-1.5.0}/docs/documentation/documentation.rst +0 -0
- {plothist-1.4.0 → plothist-1.5.0}/docs/documentation/statistics.rst +0 -0
- {plothist-1.4.0 → plothist-1.5.0}/docs/documentation/troubleshooting.rst +0 -0
- {plothist-1.4.0 → plothist-1.5.0}/docs/img/1d_comparison_advanced.svg +0 -0
- {plothist-1.4.0 → plothist-1.5.0}/docs/img/2d_hist_with_projections.svg +0 -0
- {plothist-1.4.0 → plothist-1.5.0}/docs/img/model_examples_stacked.svg +0 -0
- {plothist-1.4.0 → plothist-1.5.0}/docs/img/pyhf_example.svg +0 -0
- {plothist-1.4.0 → plothist-1.5.0}/docs/img/savefig_comparisons.gif +0 -0
- {plothist-1.4.0 → plothist-1.5.0}/docs/usage/installation.rst +0 -0
- {plothist-1.4.0 → plothist-1.5.0}/src/plothist/__init__.py +0 -0
- {plothist-1.4.0 → plothist-1.5.0}/src/plothist/_version.pyi +0 -0
- {plothist-1.4.0 → plothist-1.5.0}/src/plothist/default_style.mplstyle +0 -0
- {plothist-1.4.0/docs → plothist-1.5.0/src/plothist}/examples/1d_hist/1d_comparison_only_efficiency.py +0 -0
- {plothist-1.4.0/docs → plothist-1.5.0/src/plothist}/examples/1d_hist/1d_comparison_ratio.py +0 -0
- {plothist-1.4.0/docs → plothist-1.5.0/src/plothist}/examples/1d_hist/1d_elt1.py +0 -0
- {plothist-1.4.0/docs → plothist-1.5.0/src/plothist}/examples/1d_hist/1d_elt2.py +0 -0
- {plothist-1.4.0/docs → plothist-1.5.0/src/plothist}/examples/1d_hist/1d_hist_simple.py +0 -0
- {plothist-1.4.0/docs → plothist-1.5.0/src/plothist}/examples/1d_hist/1d_int_category.py +0 -0
- {plothist-1.4.0/docs → plothist-1.5.0/src/plothist}/examples/1d_hist/1d_profile.py +0 -0
- {plothist-1.4.0/docs → plothist-1.5.0/src/plothist}/examples/1d_hist/1d_side_by_side.py +0 -0
- {plothist-1.4.0/docs → plothist-1.5.0/src/plothist}/examples/1d_hist/1d_str_category.py +0 -0
- {plothist-1.4.0/docs → plothist-1.5.0/src/plothist}/examples/1d_hist/README.rst +0 -0
- {plothist-1.4.0/docs → plothist-1.5.0/src/plothist}/examples/2d_hist/2d_hist_uneven.py +0 -0
- {plothist-1.4.0/docs → plothist-1.5.0/src/plothist}/examples/2d_hist/README.rst +0 -0
- {plothist-1.4.0/docs → plothist-1.5.0/src/plothist}/examples/README.rst +0 -0
- {plothist-1.4.0/docs → plothist-1.5.0/src/plothist}/examples/advanced/README.rst +0 -0
- {plothist-1.4.0/docs/examples/1d_func → plothist-1.5.0/src/plothist/examples/func_1d}/README.rst +0 -0
- {plothist-1.4.0/docs → plothist-1.5.0/src/plothist}/examples/model_ex/README.rst +0 -0
- {plothist-1.4.0/docs → plothist-1.5.0/src/plothist}/examples/utility/README.rst +0 -0
|
@@ -19,13 +19,14 @@ jobs:
|
|
|
19
19
|
- uses: actions/checkout@v4
|
|
20
20
|
|
|
21
21
|
- name: Install uv and set the python version
|
|
22
|
-
uses: astral-sh/setup-uv@
|
|
22
|
+
uses: astral-sh/setup-uv@v6
|
|
23
23
|
with:
|
|
24
24
|
version: "0.6.8"
|
|
25
25
|
python-version: ${{ matrix.python-version }}
|
|
26
26
|
|
|
27
27
|
- name: Install the project
|
|
28
|
-
run:
|
|
28
|
+
run: |
|
|
29
|
+
uv sync --group dev --group test
|
|
29
30
|
|
|
30
31
|
- name: Run pre-commit
|
|
31
32
|
run: |
|
|
@@ -33,4 +34,12 @@ jobs:
|
|
|
33
34
|
|
|
34
35
|
- name: Test with pytest
|
|
35
36
|
run: |
|
|
36
|
-
uv run python -m pytest
|
|
37
|
+
uv run python -m pytest -r sa --mpl --mpl-results-path=pytest_results -n auto
|
|
38
|
+
|
|
39
|
+
- name: Upload pytest test results
|
|
40
|
+
uses: actions/upload-artifact@v4
|
|
41
|
+
if: failure()
|
|
42
|
+
with:
|
|
43
|
+
name: pytest_results-${{ matrix.python-version }}
|
|
44
|
+
retention-days: 3
|
|
45
|
+
path: pytest_results
|
|
@@ -8,6 +8,8 @@ registry.yaml
|
|
|
8
8
|
test.yaml
|
|
9
9
|
temp_img/
|
|
10
10
|
.venv
|
|
11
|
+
.nox/
|
|
12
|
+
.coverage
|
|
11
13
|
|
|
12
14
|
# Ignore local readthedocs build
|
|
13
15
|
html/
|
|
@@ -16,6 +18,7 @@ docs/examples/*/*.svg
|
|
|
16
18
|
example_gallery/
|
|
17
19
|
.svg_metadata.yaml
|
|
18
20
|
tests/*.yaml
|
|
21
|
+
pytest_results/
|
|
19
22
|
|
|
20
23
|
# Version file
|
|
21
24
|
_version.py
|
|
@@ -30,7 +30,7 @@ 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.12.2
|
|
34
34
|
hooks:
|
|
35
35
|
- id: ruff
|
|
36
36
|
args: ["--fix", "--show-fixes"]
|
|
@@ -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.33.2
|
|
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.16.1
|
|
54
54
|
hooks:
|
|
55
55
|
- id: mypy
|
|
56
56
|
files: src
|
|
@@ -66,13 +66,13 @@ repos:
|
|
|
66
66
|
- id: rst-inline-touching-normal
|
|
67
67
|
|
|
68
68
|
- repo: https://github.com/python-jsonschema/check-jsonschema
|
|
69
|
-
rev: 0.
|
|
69
|
+
rev: 0.33.2
|
|
70
70
|
hooks:
|
|
71
71
|
- id: check-readthedocs
|
|
72
72
|
- id: check-dependabot
|
|
73
73
|
- id: check-github-workflows
|
|
74
74
|
|
|
75
75
|
- repo: https://github.com/henryiii/validate-pyproject-schema-store
|
|
76
|
-
rev: 2025.
|
|
76
|
+
rev: 2025.06.23
|
|
77
77
|
hooks:
|
|
78
78
|
- id: validate-pyproject
|
|
@@ -60,6 +60,8 @@ You can also run specific nox sessions:
|
|
|
60
60
|
nox -s docs -- -b linkcheck
|
|
61
61
|
# Run the tests with coverage (takes a while)
|
|
62
62
|
nox -s coverage
|
|
63
|
+
# Generate the example figures. Needed if you update any of the example scripts.
|
|
64
|
+
nox -s generate_examples_figures -- tests/test_examples_*.py
|
|
63
65
|
|
|
64
66
|
Linters and Formatters
|
|
65
67
|
----------------------
|
|
@@ -31,7 +31,7 @@ We also show an example of how to scale the model to the data. We take advantage
|
|
|
31
31
|
from plothist import make_hist, get_color_palette
|
|
32
32
|
|
|
33
33
|
key = "variable_1"
|
|
34
|
-
range =
|
|
34
|
+
range = (-9, 12)
|
|
35
35
|
category = "category"
|
|
36
36
|
|
|
37
37
|
# Define some masks to separate the dataset in signal (1 category), background (3 categories) and data (1 category)
|
|
@@ -88,11 +88,11 @@ Histograms
|
|
|
88
88
|
|
|
89
89
|
Here is an example with a model made of 3 stacked and 1 unstacked histograms. The calculated sum is the sum of all 4 histograms.
|
|
90
90
|
|
|
91
|
-
.. literalinclude::
|
|
91
|
+
.. literalinclude:: ../../src/plothist/examples/model_ex/model_with_stacked_and_unstacked_histograms_components.py
|
|
92
92
|
:language: python
|
|
93
93
|
:start-after: ###
|
|
94
94
|
|
|
95
|
-
.. image:: ../img/model_with_stacked_and_unstacked_histograms_components.
|
|
95
|
+
.. image:: ../img/model_with_stacked_and_unstacked_histograms_components.png
|
|
96
96
|
:alt: Plot of a model with stacked and unstacked histograms components
|
|
97
97
|
:width: 500
|
|
98
98
|
|
|
@@ -104,11 +104,11 @@ Functions
|
|
|
104
104
|
|
|
105
105
|
Here is an example with a model made of 2 stacked and 1 unstacked functions:
|
|
106
106
|
|
|
107
|
-
.. literalinclude::
|
|
107
|
+
.. literalinclude:: ../../src/plothist/examples/model_ex/model_with_stacked_and_unstacked_function_components.py
|
|
108
108
|
:language: python
|
|
109
109
|
:start-after: ###
|
|
110
110
|
|
|
111
|
-
.. image:: ../img/model_with_stacked_and_unstacked_function_components.
|
|
111
|
+
.. image:: ../img/model_with_stacked_and_unstacked_function_components.png
|
|
112
112
|
:alt: Plot of a model with stacked and unstacked function components
|
|
113
113
|
:width: 500
|
|
114
114
|
|
|
@@ -128,11 +128,11 @@ Stacked histograms
|
|
|
128
128
|
|
|
129
129
|
A comparison between data and a model composed of 3 stacked histograms. A signal histogram is also plotted, but it doesn't belong to the model, so it is not taken into account in the comparison.
|
|
130
130
|
|
|
131
|
-
.. literalinclude::
|
|
131
|
+
.. literalinclude:: ../../src/plothist/examples/model_ex/model_examples_stacked.py
|
|
132
132
|
:language: python
|
|
133
133
|
:start-after: ###
|
|
134
134
|
|
|
135
|
-
.. image:: ../img/model_examples_stacked.
|
|
135
|
+
.. image:: ../img/model_examples_stacked.png
|
|
136
136
|
:alt: Data/model comparison, stacked plot
|
|
137
137
|
:width: 500
|
|
138
138
|
|
|
@@ -148,11 +148,11 @@ Unstacked histograms
|
|
|
148
148
|
|
|
149
149
|
The same comparison as above, but we represent the model with unstacked histograms:
|
|
150
150
|
|
|
151
|
-
.. literalinclude::
|
|
151
|
+
.. literalinclude:: ../../src/plothist/examples/model_ex/model_examples_unstacked.py
|
|
152
152
|
:language: python
|
|
153
153
|
:start-after: ###
|
|
154
154
|
|
|
155
|
-
.. image:: ../img/model_examples_unstacked.
|
|
155
|
+
.. image:: ../img/model_examples_unstacked.png
|
|
156
156
|
:alt: Data/model comparison, stacked plot
|
|
157
157
|
:width: 500
|
|
158
158
|
|
|
@@ -162,11 +162,11 @@ Stacked and unstacked histograms
|
|
|
162
162
|
|
|
163
163
|
Stacked and unstacked histograms can be combined. The sum of the model components is always the sum of all the components, stacked and unstacked. Below is the same comparison as above, but the model is now composed of 2 stacked and 1 unstacked histograms:
|
|
164
164
|
|
|
165
|
-
.. literalinclude::
|
|
165
|
+
.. literalinclude:: ../../src/plothist/examples/model_ex/model_examples_stacked_unstacked.py
|
|
166
166
|
:language: python
|
|
167
167
|
:start-after: ###
|
|
168
168
|
|
|
169
|
-
.. image:: ../img/model_examples_stacked_unstacked.
|
|
169
|
+
.. image:: ../img/model_examples_stacked_unstacked.png
|
|
170
170
|
:alt: Data/model comparison, stacked and unstacked plot with histograms
|
|
171
171
|
:width: 500
|
|
172
172
|
|
|
@@ -176,11 +176,11 @@ Models made of functions
|
|
|
176
176
|
|
|
177
177
|
The function :func:`plot_data_model_comparison() <plothist.plotters.plot_data_model_comparison>` can also be used to compare data and a model made of functions. The model below is composed of 2 stacked and 1 unstacked functions. All the functions contribute to the model. The sum of the model components is the sum of all the components, stacked and unstacked:
|
|
178
178
|
|
|
179
|
-
.. literalinclude::
|
|
179
|
+
.. literalinclude:: ../../src/plothist/examples/model_ex/ratio_data_vs_model_with_stacked_and_unstacked_function_components.py
|
|
180
180
|
:language: python
|
|
181
181
|
:start-after: ###
|
|
182
182
|
|
|
183
|
-
.. image:: ../img/ratio_data_vs_model_with_stacked_and_unstacked_function_components.
|
|
183
|
+
.. image:: ../img/ratio_data_vs_model_with_stacked_and_unstacked_function_components.png
|
|
184
184
|
:alt: Data/Model comparison, model with stacked and unstacked function components
|
|
185
185
|
:width: 500
|
|
186
186
|
|
|
@@ -193,22 +193,22 @@ Model uncertainty
|
|
|
193
193
|
|
|
194
194
|
As said earlier, the comparison function can take any comparison method available in :func:`plot_comparison() <plothist.plotters.plot_comparison>`. To use pulls instead of the ratio to compare the histograms:
|
|
195
195
|
|
|
196
|
-
.. literalinclude::
|
|
196
|
+
.. literalinclude:: ../../src/plothist/examples/model_ex/model_examples_pull.py
|
|
197
197
|
:language: python
|
|
198
198
|
:start-after: ###
|
|
199
199
|
|
|
200
|
-
.. image:: ../img/model_examples_pull.
|
|
200
|
+
.. image:: ../img/model_examples_pull.png
|
|
201
201
|
:alt: Data/model comparison with pull, stacked plot
|
|
202
202
|
:width: 500
|
|
203
203
|
|
|
204
204
|
|
|
205
205
|
Now, if you do not want to show nor take into account the model uncertainties, setting ``model_uncertainty`` to ``False`` removes them and updates the definition of the pulls:
|
|
206
206
|
|
|
207
|
-
.. literalinclude::
|
|
207
|
+
.. literalinclude:: ../../src/plothist/examples/model_ex/model_examples_pull_no_model_unc.py
|
|
208
208
|
:language: python
|
|
209
209
|
:start-after: ###
|
|
210
210
|
|
|
211
|
-
.. image:: ../img/model_examples_pull_no_model_unc.
|
|
211
|
+
.. image:: ../img/model_examples_pull_no_model_unc.png
|
|
212
212
|
:alt: Data/model comparison with pull, no model stat. unc., stacked plot
|
|
213
213
|
:width: 500
|
|
214
214
|
|
|
@@ -228,11 +228,11 @@ All the different comparisons
|
|
|
228
228
|
|
|
229
229
|
Below is shown how to make a plot with all the possible comparisons between data and model. The idea is to use :func:`plot_data_model_comparison() <plothist.plotters.plot_data_model_comparison>` to make the plot with the ratio comparison, and then use :func:`plot_comparison() <plothist.plotters.plot_comparison>` to add the other comparisons. The :func:`plot_comparison() <plothist.plotters.plot_comparison>` function can take a ``fig`` and ``ax`` argument to add the comparison to an existing figure. The :func:`plot_data_model_comparison() <plothist.plotters.plot_data_model_comparison>` function returns the figure and axes used to make the plot, so we can use them to add the other comparisons.
|
|
230
230
|
|
|
231
|
-
.. literalinclude::
|
|
231
|
+
.. literalinclude:: ../../src/plothist/examples/model_ex/model_all_comparisons.py
|
|
232
232
|
:language: python
|
|
233
233
|
:start-after: ###
|
|
234
234
|
|
|
235
|
-
.. image:: ../img/model_all_comparisons.
|
|
235
|
+
.. image:: ../img/model_all_comparisons.png
|
|
236
236
|
:alt: Data/model comparison with all comparisons, stacked plot
|
|
237
237
|
:width: 500
|
|
238
238
|
|
|
@@ -243,10 +243,10 @@ No model uncertainties
|
|
|
243
243
|
|
|
244
244
|
Same example as above, but we remove the statistical uncertainties of the model by adding ``model_uncertainty=False`` in :func:`plot_data_model_comparison() <plothist.plotters.plot_data_model_comparison>` and pass a model histogram without uncertainties to :func:`plot_comparison() <plothist.plotters.plot_comparison>`:
|
|
245
245
|
|
|
246
|
-
.. literalinclude::
|
|
246
|
+
.. literalinclude:: ../../src/plothist/examples/model_ex/model_all_comparisons_no_model_unc.py
|
|
247
247
|
:language: python
|
|
248
248
|
:start-after: ###
|
|
249
249
|
|
|
250
|
-
.. image:: ../img/model_all_comparisons_no_model_unc.
|
|
250
|
+
.. image:: ../img/model_all_comparisons_no_model_unc.png
|
|
251
251
|
:alt: Data/model comparison with all comparisons, no model uncertainties, stacked plot
|
|
252
252
|
:width: 500
|
|
@@ -19,11 +19,11 @@ Advanced example comparing two histograms
|
|
|
19
19
|
|
|
20
20
|
In this example, we will compare two tuples of histograms and use pull and ratio comparisons. First, we make the histograms and scale them. Then, we plot the histograms and the comparison plots on different axes:
|
|
21
21
|
|
|
22
|
-
.. image:: ../img/1d_comparison_advanced.
|
|
22
|
+
.. image:: ../img/1d_comparison_advanced.png
|
|
23
23
|
:alt: Advanced hist comparison
|
|
24
24
|
:width: 500
|
|
25
25
|
|
|
26
|
-
.. literalinclude::
|
|
26
|
+
.. literalinclude:: ../../src/plothist/examples/advanced/1d_comparison_advanced.py
|
|
27
27
|
:language: python
|
|
28
28
|
:start-after: ###
|
|
29
29
|
|
|
@@ -34,11 +34,11 @@ Advanced example using asymmetry comparison
|
|
|
34
34
|
|
|
35
35
|
This example shows how to plot an asymmetry plot between two histograms and two functions. Information on how to convert a function from an external fitting package to an object that can be used by ``plothist`` can be found in :ref:`plot-fit-result-label`.
|
|
36
36
|
|
|
37
|
-
.. image:: ../img/asymmetry_comparison_advanced.
|
|
37
|
+
.. image:: ../img/asymmetry_comparison_advanced.png
|
|
38
38
|
:alt: Advanced asymmetry comparison
|
|
39
39
|
:width: 500
|
|
40
40
|
|
|
41
|
-
.. literalinclude::
|
|
41
|
+
.. literalinclude:: ../../src/plothist/examples/advanced/asymmetry_comparison_advanced.py
|
|
42
42
|
:language: python
|
|
43
43
|
:start-after: ###
|
|
44
44
|
|
|
@@ -47,11 +47,11 @@ Flatten 2D variable
|
|
|
47
47
|
|
|
48
48
|
Compare data and stacked histogram for a flatten 2D variable:
|
|
49
49
|
|
|
50
|
-
.. image:: ../img/model_examples_flatten2D.
|
|
50
|
+
.. image:: ../img/model_examples_flatten2D.png
|
|
51
51
|
:alt: Data/model comparison, flatten variable
|
|
52
52
|
:width: 500
|
|
53
53
|
|
|
54
|
-
.. literalinclude::
|
|
54
|
+
.. literalinclude:: ../../src/plothist/examples/advanced/model_examples_flatten2D.py
|
|
55
55
|
:language: python
|
|
56
56
|
:start-after: ###
|
|
57
57
|
|
|
@@ -61,10 +61,10 @@ Multiple histograms, side by side, with numbers on top
|
|
|
61
61
|
|
|
62
62
|
This example shows how to plot multiple 1D histograms side by side, with numbers on top of each bars. The code is similar to the one used in the :ref:`basics-1d_hist_side_by_side-label` section.
|
|
63
63
|
|
|
64
|
-
.. image:: ../img/1d_side_by_side_with_numbers.
|
|
64
|
+
.. image:: ../img/1d_side_by_side_with_numbers.png
|
|
65
65
|
:alt: Multiple histograms side by side
|
|
66
66
|
:width: 500
|
|
67
67
|
|
|
68
|
-
.. literalinclude::
|
|
68
|
+
.. literalinclude:: ../../src/plothist/examples/advanced/1d_side_by_side_with_numbers.py
|
|
69
69
|
:language: python
|
|
70
70
|
:start-after: ###
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
.. _basics-
|
|
1
|
+
.. _basics-func_1d-label:
|
|
2
2
|
|
|
3
3
|
==============
|
|
4
4
|
Plot functions
|
|
@@ -25,21 +25,21 @@ Simple function
|
|
|
25
25
|
|
|
26
26
|
Plothist supports plotting of functions using the :func:`plot_function() <plothist.plotters.plot_function>` function:
|
|
27
27
|
|
|
28
|
-
.. literalinclude::
|
|
28
|
+
.. literalinclude:: ../../src/plothist/examples/func_1d/fct_1d.py
|
|
29
29
|
:language: python
|
|
30
30
|
:start-after: ###
|
|
31
31
|
|
|
32
|
-
.. image:: ../img/
|
|
32
|
+
.. image:: ../img/fct_1d.png
|
|
33
33
|
:alt: Simple function
|
|
34
34
|
:width: 500
|
|
35
35
|
|
|
36
36
|
In particular, you can stack functions using the ``stacked=True`` argument:
|
|
37
37
|
|
|
38
|
-
.. literalinclude::
|
|
38
|
+
.. literalinclude:: ../../src/plothist/examples/func_1d/fct_1d_stacked.py
|
|
39
39
|
:language: python
|
|
40
40
|
:start-after: ###
|
|
41
41
|
|
|
42
|
-
.. image:: ../img/
|
|
42
|
+
.. image:: ../img/fct_1d_stacked.png
|
|
43
43
|
:alt: Simple stacked function
|
|
44
44
|
:width: 500
|
|
45
45
|
|
|
@@ -24,11 +24,11 @@ Simple 1D histogram
|
|
|
24
24
|
|
|
25
25
|
To plot a simple 1D histogram, you first need to create a histogram object with the :func:`make_hist() <plothist.histogramming.make_hist>` function that you can then plot with the :func:`plot_hist() <plothist.plotters.plot_hist>` function:
|
|
26
26
|
|
|
27
|
-
.. literalinclude::
|
|
27
|
+
.. literalinclude:: ../../src/plothist/examples/1d_hist/1d_hist_simple.py
|
|
28
28
|
:language: python
|
|
29
29
|
:start-after: ###
|
|
30
30
|
|
|
31
|
-
.. image:: ../img/1d_hist_simple.
|
|
31
|
+
.. image:: ../img/1d_hist_simple.png
|
|
32
32
|
:alt: Simple hist
|
|
33
33
|
:width: 500
|
|
34
34
|
|
|
@@ -39,22 +39,22 @@ To plot a simple 1D histogram, you first need to create a histogram object with
|
|
|
39
39
|
|
|
40
40
|
To add multiple histograms to the same plot, you can just call the :func:`make_hist() <plothist.histogramming.make_hist>` and :func:`plot_hist() <plothist.plotters.plot_hist>` functions multiple times:
|
|
41
41
|
|
|
42
|
-
.. literalinclude::
|
|
42
|
+
.. literalinclude:: ../../src/plothist/examples/1d_hist/1d_elt1.py
|
|
43
43
|
:language: python
|
|
44
44
|
:start-after: ###
|
|
45
45
|
|
|
46
|
-
.. image:: ../img/1d_elt1.
|
|
46
|
+
.. image:: ../img/1d_elt1.png
|
|
47
47
|
:alt: Simple hist
|
|
48
48
|
:width: 500
|
|
49
49
|
|
|
50
50
|
|
|
51
51
|
To stack them, use the argument ``stacked=True`` in the :func:`plot_hist() <plothist.plotters.plot_hist>` function:
|
|
52
52
|
|
|
53
|
-
.. literalinclude::
|
|
53
|
+
.. literalinclude:: ../../src/plothist/examples/1d_hist/1d_elt1_stacked.py
|
|
54
54
|
:language: python
|
|
55
55
|
:start-after: ###
|
|
56
56
|
|
|
57
|
-
.. image:: ../img/1d_elt1_stacked.
|
|
57
|
+
.. image:: ../img/1d_elt1_stacked.png
|
|
58
58
|
:alt: Simple stacked hist
|
|
59
59
|
:width: 500
|
|
60
60
|
|
|
@@ -64,11 +64,11 @@ Histogram with error bars
|
|
|
64
64
|
|
|
65
65
|
To plot a simple histogram with error bars, use the :func:`plot_error_hist() <plothist.plotters.plot_error_hist>` function. The default error bars are the Poisson standard deviation derived from the variance stored in the histogram object.
|
|
66
66
|
|
|
67
|
-
.. literalinclude::
|
|
67
|
+
.. literalinclude:: ../../src/plothist/examples/1d_hist/1d_elt2.py
|
|
68
68
|
:language: python
|
|
69
69
|
:start-after: ###
|
|
70
70
|
|
|
71
|
-
.. image:: ../img/1d_elt2.
|
|
71
|
+
.. image:: ../img/1d_elt2.png
|
|
72
72
|
:alt: Simple error hist
|
|
73
73
|
:width: 500
|
|
74
74
|
|
|
@@ -89,11 +89,11 @@ Ratio
|
|
|
89
89
|
|
|
90
90
|
Ratio is the default comparison method:
|
|
91
91
|
|
|
92
|
-
.. literalinclude::
|
|
92
|
+
.. literalinclude:: ../../src/plothist/examples/1d_hist/1d_comparison_ratio.py
|
|
93
93
|
:language: python
|
|
94
94
|
:start-after: ###
|
|
95
95
|
|
|
96
|
-
.. image:: ../img/1d_comparison_ratio.
|
|
96
|
+
.. image:: ../img/1d_comparison_ratio.png
|
|
97
97
|
:alt: Simple ratio comparison
|
|
98
98
|
:width: 500
|
|
99
99
|
|
|
@@ -103,11 +103,11 @@ Split ratio
|
|
|
103
103
|
|
|
104
104
|
When the ``split_ratio`` option is used, both the h1 and h2 uncertainties are scaled down by the h2 bin contents. The h2 adjusted uncertainties are shown separately as a hatched area. In practice, the ``split_ratio`` comparison option is used when h1 is filled with measured data and h2 is a model, see :ref:`advanced-model_comparison-label` section for more details.
|
|
105
105
|
|
|
106
|
-
.. literalinclude::
|
|
106
|
+
.. literalinclude:: ../../src/plothist/examples/1d_hist/1d_comparison_split_ratio.py
|
|
107
107
|
:language: python
|
|
108
108
|
:start-after: ###
|
|
109
109
|
|
|
110
|
-
.. image:: ../img/1d_comparison_split_ratio.
|
|
110
|
+
.. image:: ../img/1d_comparison_split_ratio.png
|
|
111
111
|
:alt: Simple split ratio comparison
|
|
112
112
|
:width: 500
|
|
113
113
|
|
|
@@ -117,11 +117,11 @@ Pull
|
|
|
117
117
|
|
|
118
118
|
To perform a pull comparison between two histograms:
|
|
119
119
|
|
|
120
|
-
.. literalinclude::
|
|
120
|
+
.. literalinclude:: ../../src/plothist/examples/1d_hist/1d_comparison_pull.py
|
|
121
121
|
:language: python
|
|
122
122
|
:start-after: ###
|
|
123
123
|
|
|
124
|
-
.. image:: ../img/1d_comparison_pull.
|
|
124
|
+
.. image:: ../img/1d_comparison_pull.png
|
|
125
125
|
:alt: Simple pull comparison
|
|
126
126
|
:width: 500
|
|
127
127
|
|
|
@@ -131,11 +131,11 @@ Difference
|
|
|
131
131
|
|
|
132
132
|
To plot the difference between two histograms:
|
|
133
133
|
|
|
134
|
-
.. literalinclude::
|
|
134
|
+
.. literalinclude:: ../../src/plothist/examples/1d_hist/1d_comparison_difference.py
|
|
135
135
|
:language: python
|
|
136
136
|
:start-after: ###
|
|
137
137
|
|
|
138
|
-
.. image:: ../img/1d_comparison_difference.
|
|
138
|
+
.. image:: ../img/1d_comparison_difference.png
|
|
139
139
|
:alt: Simple difference comparison
|
|
140
140
|
:width: 500
|
|
141
141
|
|
|
@@ -145,11 +145,11 @@ Relative difference
|
|
|
145
145
|
|
|
146
146
|
To plot the relative difference between two histograms:
|
|
147
147
|
|
|
148
|
-
.. literalinclude::
|
|
148
|
+
.. literalinclude:: ../../src/plothist/examples/1d_hist/1d_comparison_relative_difference.py
|
|
149
149
|
:language: python
|
|
150
150
|
:start-after: ###
|
|
151
151
|
|
|
152
|
-
.. image:: ../img/1d_comparison_relative_difference.
|
|
152
|
+
.. image:: ../img/1d_comparison_relative_difference.png
|
|
153
153
|
:alt: Simple difference comparison
|
|
154
154
|
:width: 500
|
|
155
155
|
|
|
@@ -159,11 +159,11 @@ Asymmetry
|
|
|
159
159
|
|
|
160
160
|
To plot the asymmetry between two histograms:
|
|
161
161
|
|
|
162
|
-
.. literalinclude::
|
|
162
|
+
.. literalinclude:: ../../src/plothist/examples/1d_hist/1d_comparison_asymmetry.py
|
|
163
163
|
:language: python
|
|
164
164
|
:start-after: ###
|
|
165
165
|
|
|
166
|
-
.. image:: ../img/1d_comparison_asymmetry.
|
|
166
|
+
.. image:: ../img/1d_comparison_asymmetry.png
|
|
167
167
|
:alt: Simple asymmetry comparison
|
|
168
168
|
:width: 500
|
|
169
169
|
|
|
@@ -173,11 +173,11 @@ Efficiency
|
|
|
173
173
|
|
|
174
174
|
This example shows how to plot the ratio between two histograms h1 and h2 when the entries of h1 are a subset of the entries of h2. The variances are calculated according to the formula given in :ref:`documentation-statistics-label`.
|
|
175
175
|
|
|
176
|
-
.. literalinclude::
|
|
176
|
+
.. literalinclude:: ../../src/plothist/examples/1d_hist/1d_comparison_efficiency.py
|
|
177
177
|
:language: python
|
|
178
178
|
:start-after: ###
|
|
179
179
|
|
|
180
|
-
.. image:: ../img/1d_comparison_efficiency.
|
|
180
|
+
.. image:: ../img/1d_comparison_efficiency.png
|
|
181
181
|
:alt: Simple efficiency comparison
|
|
182
182
|
:width: 500
|
|
183
183
|
|
|
@@ -187,11 +187,11 @@ To only plot the comparison
|
|
|
187
187
|
|
|
188
188
|
With any of the comparison shown above, you can use the :func:`plot_comparison() <plothist.plotters.plot_comparison>` function to only plot the comparison. Here is an example with the efficiency comparison of two histograms:
|
|
189
189
|
|
|
190
|
-
.. literalinclude::
|
|
190
|
+
.. literalinclude:: ../../src/plothist/examples/1d_hist/1d_comparison_only_efficiency.py
|
|
191
191
|
:language: python
|
|
192
192
|
:start-after: ###
|
|
193
193
|
|
|
194
|
-
.. image:: ../img/1d_comparison_only_efficiency.
|
|
194
|
+
.. image:: ../img/1d_comparison_only_efficiency.png
|
|
195
195
|
:alt: Simple efficiency comparison, only the comparison
|
|
196
196
|
:width: 500
|
|
197
197
|
|
|
@@ -220,11 +220,11 @@ In this example, the data points and the error bars are the average value and th
|
|
|
220
220
|
Note that most functions in ``plothist`` work only with counting histograms and will raise an error if you try to use them with a mean histogram.
|
|
221
221
|
|
|
222
222
|
|
|
223
|
-
.. literalinclude::
|
|
223
|
+
.. literalinclude:: ../../src/plothist/examples/1d_hist/1d_profile.py
|
|
224
224
|
:language: python
|
|
225
225
|
:start-after: ###
|
|
226
226
|
|
|
227
|
-
.. image:: ../img/1d_profile.
|
|
227
|
+
.. image:: ../img/1d_profile.png
|
|
228
228
|
:alt: Profile plot
|
|
229
229
|
:width: 500
|
|
230
230
|
|
|
@@ -239,11 +239,11 @@ The examples below show how to create a histogram with a category axis in ``boos
|
|
|
239
239
|
Integer category
|
|
240
240
|
----------------
|
|
241
241
|
|
|
242
|
-
.. literalinclude::
|
|
242
|
+
.. literalinclude:: ../../src/plothist/examples/1d_hist/1d_int_category.py
|
|
243
243
|
:language: python
|
|
244
244
|
:start-after: ###
|
|
245
245
|
|
|
246
|
-
.. image:: ../img/1d_int_category.
|
|
246
|
+
.. image:: ../img/1d_int_category.png
|
|
247
247
|
:alt: Integer category plot
|
|
248
248
|
:width: 500
|
|
249
249
|
|
|
@@ -256,11 +256,11 @@ Integer category
|
|
|
256
256
|
String category
|
|
257
257
|
---------------
|
|
258
258
|
|
|
259
|
-
.. literalinclude::
|
|
259
|
+
.. literalinclude:: ../../src/plothist/examples/1d_hist/1d_str_category.py
|
|
260
260
|
:language: python
|
|
261
261
|
:start-after: ###
|
|
262
262
|
|
|
263
|
-
.. image:: ../img/1d_str_category.
|
|
263
|
+
.. image:: ../img/1d_str_category.png
|
|
264
264
|
:alt: String category plot
|
|
265
265
|
:width: 500
|
|
266
266
|
|
|
@@ -271,10 +271,10 @@ Using multiple histograms
|
|
|
271
271
|
|
|
272
272
|
With multiple histograms, the :func:`plot_hist() <plothist.plotters.plot_hist>` function will correctly put them side by side, because it is a wrapper around the ``hist()`` function from ``matplotlib`` that provides this functionality.
|
|
273
273
|
|
|
274
|
-
.. image:: ../img/1d_side_by_side.
|
|
274
|
+
.. image:: ../img/1d_side_by_side.png
|
|
275
275
|
:alt: Side by side histograms
|
|
276
276
|
:width: 500
|
|
277
277
|
|
|
278
|
-
.. literalinclude::
|
|
278
|
+
.. literalinclude:: ../../src/plothist/examples/1d_hist/1d_side_by_side.py
|
|
279
279
|
:language: python
|
|
280
280
|
:start-after: ###
|
|
@@ -22,11 +22,11 @@ Simple plot
|
|
|
22
22
|
|
|
23
23
|
Plotting a simple 2D histogram is very similar to plotting a 1D histogram. The function :func:`make_2d_hist() <plothist.histogramming.make_2d_hist>` is used to create the 2D histogram, and the function :func:`plot_2d_hist() <plothist.plotters.plot_2d_hist>` is used to plot it.
|
|
24
24
|
|
|
25
|
-
.. literalinclude::
|
|
25
|
+
.. literalinclude:: ../../src/plothist/examples/2d_hist/2d_hist_simple.py
|
|
26
26
|
:language: python
|
|
27
27
|
:start-after: ###
|
|
28
28
|
|
|
29
|
-
.. image:: ../img/2d_hist_simple.
|
|
29
|
+
.. image:: ../img/2d_hist_simple.png
|
|
30
30
|
:alt: Simple 2d hist
|
|
31
31
|
:width: 500
|
|
32
32
|
|
|
@@ -38,11 +38,11 @@ The argument ``cmap`` in ``pcolormesh_kwargs`` can be used to change the colorma
|
|
|
38
38
|
|
|
39
39
|
Here is a more complex example on how to get a discrete colormap:
|
|
40
40
|
|
|
41
|
-
.. literalinclude::
|
|
41
|
+
.. literalinclude:: ../../src/plothist/examples/2d_hist/2d_hist_simple_discrete_colormap.py
|
|
42
42
|
:language: python
|
|
43
43
|
:start-after: ###
|
|
44
44
|
|
|
45
|
-
.. image:: ../img/2d_hist_simple_discrete_colormap.
|
|
45
|
+
.. image:: ../img/2d_hist_simple_discrete_colormap.png
|
|
46
46
|
:alt: Simple 2d hist with discrete colormap
|
|
47
47
|
:width: 500
|
|
48
48
|
|
|
@@ -53,22 +53,22 @@ Correlations with variable registry
|
|
|
53
53
|
|
|
54
54
|
The variable registry is a really useful tool to manage and plot the correlation between multiple variables (see :ref:`basics-variable_registry-label` on how to use it.)
|
|
55
55
|
|
|
56
|
-
.. literalinclude::
|
|
56
|
+
.. literalinclude:: ../../src/plothist/examples/2d_hist/2d_hist_correlations.py
|
|
57
57
|
:language: python
|
|
58
58
|
:start-after: ###
|
|
59
59
|
|
|
60
60
|
|
|
61
61
|
|img1| |img2| |img3|
|
|
62
62
|
|
|
63
|
-
.. |img1| image:: ../img/2d_hist_correlations_0.
|
|
63
|
+
.. |img1| image:: ../img/2d_hist_correlations_0.png
|
|
64
64
|
:alt: 2d correlation plot
|
|
65
65
|
:width: 210
|
|
66
66
|
|
|
67
|
-
.. |img2| image:: ../img/2d_hist_correlations_1.
|
|
67
|
+
.. |img2| image:: ../img/2d_hist_correlations_1.png
|
|
68
68
|
:alt: 2d correlation plot
|
|
69
69
|
:width: 210
|
|
70
70
|
|
|
71
|
-
.. |img3| image:: ../img/2d_hist_correlations_2.
|
|
71
|
+
.. |img3| image:: ../img/2d_hist_correlations_2.png
|
|
72
72
|
:alt: 2d correlation plot
|
|
73
73
|
:width: 210
|
|
74
74
|
|
|
@@ -78,11 +78,11 @@ Uneven binning
|
|
|
78
78
|
|
|
79
79
|
Instead of inputing a number of bins and a range in :func:`make_2d_hist() <plothist.histogramming.make_2d_hist>`, the bins parameter can be a list of all the edges:
|
|
80
80
|
|
|
81
|
-
.. literalinclude::
|
|
81
|
+
.. literalinclude:: ../../src/plothist/examples/2d_hist/2d_hist_uneven.py
|
|
82
82
|
:language: python
|
|
83
83
|
:start-after: ###
|
|
84
84
|
|
|
85
|
-
.. image:: ../img/2d_hist_uneven.
|
|
85
|
+
.. image:: ../img/2d_hist_uneven.png
|
|
86
86
|
:alt: 2d hist with uneven binning
|
|
87
87
|
:width: 500
|
|
88
88
|
|
|
@@ -93,10 +93,10 @@ Display 1D distributions
|
|
|
93
93
|
|
|
94
94
|
To plot a 2d histogram with x and y projections, the function :func:`plot_2d_hist_with_projections() <plothist.plotters.plot_2d_hist_with_projections>` can be used. The corresponding projections are displayed on the top and right of the 2D histogram, and the colorbar is clearly displayed and labeled.
|
|
95
95
|
|
|
96
|
-
.. literalinclude::
|
|
96
|
+
.. literalinclude:: ../../src/plothist/examples/2d_hist/2d_hist_with_projections.py
|
|
97
97
|
:language: python
|
|
98
98
|
:start-after: ###
|
|
99
99
|
|
|
100
|
-
.. image:: ../img/2d_hist_with_projections.
|
|
100
|
+
.. image:: ../img/2d_hist_with_projections.png
|
|
101
101
|
:alt: 2d hist with x and y projections
|
|
102
102
|
:width: 500
|