tutorials/graphics/canvas2.C:: CanvasPartition - adaptation for TRatioPlot

root 6.18.04
It seems that the CanvasPartition from the canvas2.C is not working for TRatioPlots (i imagine because the distinct components that a TRatioPlot has). Unfortunately it is not clear to me what pad to reference and how to create a line (Ny=1) of joined TRatioPlots. here i have my current macro (that does not work as expected) (the CanvasPartition function is copied to the ROOT_FUNCTIONS.C that i include - at the end of file) (i tried also the version from here)
Does anybody have a hint about the joining of TRatioPlots? (moreover it seems that i cannot set the range of x axis)
Thanks a lot!!

I have some difficulties to run your example:

Processing comparison.C...
In file included from input_line_9:1:
In file included from /Users/couet/Downloads/comparison.C:1:
/Users/couet/Downloads/ROOT_FUNCTIONS.C:52:10: fatal error: 'AliEmcalList.h' file not found
#include <AliEmcalList.h>
         ^~~~~~~~~~~~~~~~

ermm, sorry, it can be removed, not necessary in the current example.

Ok, let me know when you have a reproducer i can run.

done, i clear up all non-root usage. thanks a lot for help!

I downloaded again the files for the cern box you pointed previously and I still get the same error:

% root comparison.C
   ------------------------------------------------------------------
  | Welcome to ROOT 6.19/01                        https://root.cern |
  | (c) 1995-2019, The ROOT Team; conception: R. Brun, F. Rademakers |
  | Built for macosx64 on Jan 27 2020, 12:10:38                      |
  | From heads/master@v6-19-01-2559-g811647b31f                      |
  | Try '.help', '.demo', '.license', '.credits', '.quit'/'.q'       |
   ------------------------------------------------------------------

root [0] 
Processing comparison.C...
In file included from input_line_9:1:
In file included from /Users/couet/Downloads/comparison.C:1:
/Users/couet/Downloads/ROOT_FUNCTIONS.C:52:10: fatal error: 'AliEmcalList.h' file not found
#include <AliEmcalList.h>
         ^~~~~~~~~~~~~~~~
root [1] 

Maybe is a cache thing? i looked again and there is no mention of Ali* in the file anymore
Could you please try downloading again?

Ok it is fine now. Thanks

I see… You are miss-using CanvasPartition. This function intend to make sure the frames inside the canvas have all the same area taking into account some margin on the left and on the right. You are working at the pads level. A simple TCanvas::Divide() should work.

I had the impression that the CanvasPartition is to be used to have “joined” figures like in the presented example. How could i replicate what is shown with Divide? i would like to have equal (at least almost) widths of the joined histograms, and only the left most to have visible ticks and labels…
Thank you!

Something like that but with TRatioPlots inside each pad ?

Attached is the best thing I got.

comparison.C (7.9 KB)

Thanks a lot! Yes, this is what i wanted (like in your figure above), and your close enough solution is perfect!! Also i see in your plot that for each histo the first 0 is distinct and does not have any clash with what should have been 5 … Could you tell me how did you do it?
Currently i have the picture below (i tried to set x range to 0, 1.1 but seems to not work)


Thanks a lot!!

I am not sure what you are talking about. Seems to me the first and last label on the x-axes can be improved with ChangeLabel. I did nothing special

Hi @couet ! On which object did you applied ChangeLabel? Applying on rp->GetLowerRefXaxis()->ChangeLabel(0,-1,0.) does not work … also, how can i size the x axis unconditionally (no matter the size of the object)? SetRangeUser on both GetLowerRefXaxis() or GetLowerRefGraph()->GetXaxis() does not work

Yes, I see it is hard to access the lower X axis.
I have no answer for the time being.

just for reference here is my current code

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.