I’m trying to add a legend to one of my figures that doesn’t fit on the figure itself. So I’d like to add it next to it, and I thought I’d do that by doubling the size of the canvas, and making two pads, one for the figure, one for the legend.
Here is the figure with the image quality I get when plotting just the figure, this is made with a 600x800 TCanvas:
canvas = ROOT.TCanvas('c', 'Title', 600, 800)
However, when trying to add the legend on a new pad, I get something different. So I tried using a 1200x800 TCanvas:
canvas = ROOT.TCanvas('c', 'Title', 1200, 800)
And then I tried dividing it into two pads. At later points I may want to divide them asymmetrically, so I’m not using TPad::Divide(), instead I’m explicitly making two pads. The pad for the figure is created on the right for x in (0.5,1.0):
figurepad = ROOT.TPad("figurepad", "figurepad",0.5,0.0,1.0,1.0)
and after Drawing the frame and content for the figure, the pad for the legend is created in (0.0,0.5) with:
legendpad = ROOT.TPad("legendpad", "legendpad",0.0,0.0,0.5,1.0)
After that the legend is Drawn and the image is saved. This is the result:
ComparisonROCplot_sparse_pt3.5.pdf (20.1 KB)
As you can see, the pdf is much, much smaller in size (resolution): it’s just 787x508 pixels, a number that I don’t understand how it computes, but even the styles on the figure itself are changed a bit. The lines are relatively thicker, and the dashed lines have longer lines and shorter spaces. I did not touch anything regarding the cosmetic code of the figure. How does this happen?
I tried varying the TCanvas size in its constructor, but it does not seem to matter. Even if I increase it to 2400x1600, I get this same output - a small, 787x508 sized pdf with different styles.
Why does this happen, what should I do differently?
Thank you for your time
ROOT Version: 6.14/04