You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This option has the advantage of being concise and ensuring that the legend entries are correctly matched to the stack or multi-graph component, but may be less flexible in case different label formats are needed for each of the components.
Fill the legend manually
Finally, following the example of matplotlib, the component handles and format strings could be manually passed to ax.legend(), instead of using label=... in the call to ax.plot():
Currently, individual components of THStacks and TMultiGraphs have to be added to the legend manually with
TLegend::AddEntry()
, e.g.:This goes against the goal of having matplotlib-like syntax and should be fixed. Possible alternatives are:
Use label=[...] in ax.plot()
Pass the legend-entry labels and the label formats as lists in the call to
ax.plot()
:This is the way matplotlib handles legend entries for stacked histograms (see https://matplotlib.org/stable/gallery/statistics/histogram_multihist.html) and has the advantage of flexibility, but it is fairly verbose.
Use label="auto" in ax.plot()
Tell atlasplots to automatically scan through the THStack or TMultiGraph and add the legend entries based on the titles of the individual components:
This option has the advantage of being concise and ensuring that the legend entries are correctly matched to the stack or multi-graph component, but may be less flexible in case different label formats are needed for each of the components.
Fill the legend manually
Finally, following the example of matplotlib, the component handles and format strings could be manually passed to
ax.legend()
, instead of usinglabel=...
in the call toax.plot()
:The text was updated successfully, but these errors were encountered: