Tight layout while plotting using matplotlib in MA5

Asked by Harshal Kulkarni

Hi,
     I am using matplotlib to plot graphs inside MA5. By default, matplotlib leaves some space before the left end of the x-range and after the right end of the x-range and that makes the histogram plots look inelegant since it seems that there is an abrupt fall. How do I use the tight layout that is usually used in matplotlib within MA5? Is there a command that gives such a plot in MA5?

Thanks,
Harshal

Question information

Language:
English Edit question
Status:
Solved
For:
MadAnalysis 5 Edit question
Assignee:
No assignee Edit question
Solved by:
Jack Y. Araz
Solved:
Last query:
Last reply:
Revision history for this message
Jack Y. Araz (jackaraz) said :
#1

Hi Harshal

Ma5 writes a python code in the outputs which automatically creates the figures. You can modify them as you like. Another way is histogram data is written in Ma5-SAF format in the output folder for each sample, you can write your own plotting tool by using it.

cheers


Jack Y. Araz

> On Jun 9, 2021, at 1:35 PM, Harshal Kulkarni <email address hidden> wrote:
>
> [EXTERNAL EMAIL]
>
> New question #697464 on MadAnalysis 5:
> https://answers.launchpad.net/madanalysis5/+question/697464
>
> Hi,
> I am using matplotlib to plot graphs inside MA5. By default, matplotlib leaves some space before the left end of the x-range and after the right end of the x-range and that makes the histogram plots look inelegant since it seems that there is an abrupt fall. How do I use the tight layout that is usually used in matplotlib within MA5? Is there a command that gives such a plot in MA5?
>
> Thanks,
> Harshal
>
> --
> You received this question notification because you are an answer
> contact for MadAnalysis 5.

Revision history for this message
Harshal Kulkarni (hck18ms056) said :
#2

But MA5 imports the .lhe events file and then using that we can plot several distributions that we want, right? How and what command should I give on the ma5 interface while plotting the distributions? Because before plotting, MA5 only imports an event file and nothing else. So is there a way to use the ma5 interface to give the tight layout command?

Thanks.

Revision history for this message
Best Jack Y. Araz (jackaraz) said :
#3

Hi

> But MA5 imports the .lhe events file and then using that we can plot
> several distributions that we want, right? How and what command should I
> give on the ma5 interface while plotting the distributions? Because
> before plotting, MA5 only imports an event file and nothing else.
I don't understand your meaning, ma5 does not need to import anything else but sample files to analyze them.

> So is there a way to use the ma5 interface to give the tight layout command?
No we did not give a separate input for every single matplotlib option instead ma5 writes you a specific code for each plot that you want to generate. You can simply modify those codes and get the output to suit your artistic standards.

cheers


Jack Y. Araz

> On Jun 9, 2021, at 2:05 PM, Harshal Kulkarni <email address hidden> wrote:
>
> [EXTERNAL EMAIL]
>
> Question #697464 on MadAnalysis 5 changed:
> https://answers.launchpad.net/madanalysis5/+question/697464
>
> Harshal Kulkarni posted a new comment:
> But MA5 imports the .lhe events file and then using that we can plot
> several distributions that we want, right? How and what command should I
> give on the ma5 interface while plotting the distributions? Because
> before plotting, MA5 only imports an event file and nothing else. So is
> there a way to use the ma5 interface to give the tight layout command?
>
> Thanks.
>
> --
> You received this question notification because you are an answer
> contact for MadAnalysis 5.

Revision history for this message
Harshal Kulkarni (hck18ms056) said :
#4

Thank you sir. I get your point of editing or modifying the codes. I misunderstood what you said earlier. I thought that I can simply use the ma5 interface to do these edits. I understood it now.

Revision history for this message
Harshal Kulkarni (hck18ms056) said :
#5

Thanks Jack Y. Araz, that solved my question.