Skip to content

Commit

Permalink
Merge pull request #100 from cyrraz/documentation-small-fix
Browse files Browse the repository at this point in the history
Small documentation update
  • Loading branch information
0ctagon authored Jan 12, 2024
2 parents 2457d9e + 6096c6a commit fd9dec8
Show file tree
Hide file tree
Showing 10 changed files with 16,023 additions and 15,950 deletions.
22 changes: 10 additions & 12 deletions docs/advanced/other_advanced.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,40 +20,38 @@ In this example, we will compare two tuples of histograms and use pull and ratio

First, we make the histograms and scale them. Then, we plot the histograms and the comparison plots on different axes:

.. literalinclude:: ../examples/advanced/1d_comparison_advanced.py
:language: python
:start-after: ###

.. image:: ../img/1d_comparison_advanced.svg
:alt: Advanced hist comparison
:width: 500

.. literalinclude:: ../examples/advanced/1d_comparison_advanced.py
:language: python
:start-after: ###


.. _advanced-asymmetry-label:
Advanced example using asymmetry comparison
===========================================

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`.

.. literalinclude:: ../examples/advanced/asymmetry_comparison_advanced.py
:language: python
:start-after: ###

.. image:: ../img/asymmetry_comparison_advanced.svg
:alt: Advanced asymmetry comparison
:width: 500

.. literalinclude:: ../examples/advanced/asymmetry_comparison_advanced.py
:language: python
:start-after: ###

Flatten 2D variable
===================

Compare data and stacked histogram for a flatten 2D variable:

.. literalinclude:: ../examples/advanced/model_examples_flatten2D.py
:language: python
:start-after: ###

.. image:: ../img/model_examples_flatten2D.svg
:alt: Data/model comparison, flatten variable
:width: 500

.. literalinclude:: ../examples/advanced/model_examples_flatten2D.py
:language: python
:start-after: ###
4 changes: 2 additions & 2 deletions docs/basics/variable_registry.rst
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ To plot multiple variables using the ``variable_manager``, you can use the follo
update_variable_registry_ranges(df, variable_keys)
# Add custom info
update_variable_registry({"text": "simulation"}, variable_keys)
update_variable_registry({"text": "my analysis"}, variable_keys)
for variable_key in variable_keys:
variable = get_variable_from_registry(variable_key)
Expand All @@ -224,7 +224,7 @@ To plot multiple variables using the ``variable_manager``, you can use the follo
ax.set_xlim(variable["range"])
ax.set_ylabel("Entries")
add_text(variable["text"], ax=ax)
add_text(variable["text"], ax=ax, x="right")
fig.savefig(f"{variable_key}.png", bbox_inches="tight")
Expand Down
4 changes: 2 additions & 2 deletions docs/examples/1d_hist/1d_comparison_asymmetry.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
h3,
xlabel=name,
ylabel="Entries",
h1_label="$h_1$",
h2_label="$h_2$",
h1_label="$h_2$",
h2_label="$h_3$",
comparison="asymmetry", # <--
)

Expand Down
4 changes: 2 additions & 2 deletions docs/examples/1d_hist/1d_comparison_relative_difference.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
h3,
xlabel=name,
ylabel="Entries",
h1_label="$\mathbf{H\,\,1}$",
h2_label="$\mathbf{H\,\,2}$",
h1_label="$\mathbf{H\,\,2}$",
h2_label="$\mathbf{H\,\,3}$",
comparison="relative_difference", # <--
)

Expand Down
2 changes: 1 addition & 1 deletion docs/examples/2d_hist/2d_hist_simple_discrete_colormap.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@

h = make_2d_hist([df[name_x][:nentries], df[name_y][:nentries]], bins=[50, 50])

###
from matplotlib.colors import ListedColormap
from plothist import get_color_palette

###
# 0 entries will be white, the rest will have one color from the plasma colormap per entry value
cmap = ListedColormap(
["white"] + list(get_color_palette("plasma", int(h.values().max()) * 2 - 1))
Expand Down
Loading

0 comments on commit fd9dec8

Please sign in to comment.