Legend options in analysis_plots.py

Hello FCC community,

I am trying to make some plots for lots of samples and I a legend for each of the samples. The problem is the legends don’t fit inside the canvas and are drawn vertically in one column. Is there a way to control the legend options like their fontsize, their position,… etc.

Best regards
Yehia

Hi @ymahmoud,

at the moment all control options for the legend are hard coded, exposing them in the plot sub command should be easy (at least for font size and legend position).

Can you share an example print screen of what is happening in the plot?

Best,
Juraj

Ok here is a screen shot

Best regards
Yehia

Hello,

Is there way I can edit the hardcoded part of the plots?

Best regards

Hi @ymahmoud,

does this PR:

allows enough adjustment or there is more needed?

Best,
Juraj

Hi @ymahmoud,

now the PR is merged into pre-edm4hep branch and also to master, you should be able to manipulate position of the legend and also size of the font used in the legend.

Command line arguments are: --legend-text-size, --legend-x-min, --legend-x-max, --legend-y-min, and --legend-y-max.
The script attributes are: legendTextSize and legendCoord (expects list of four values).

Best,
Juraj

Hi @jsmiesko
Thank you for adding the legend options. I would also suggest adding TLegend.SetNColumns(n).
If you want the legend to not be in just one column.

Best,
Yehia

Hi @ymahmoud,

At the moment you can have two columns if you use splitLeg = True in your plotting script.

I would not go for more than two columns…

Best,
Juraj