TH2D, fixed axis aspect ratio display problems with eps

Hi Rooters,

I’ve been trying for a while to produce 2D plots where both axes have the same length but I can’t seem to make the plots sit where I want them on the pad.

The plots show the correlation between two parameters so it’s vital that both the axes are the same length.
Each axis is centred on the parameter fit value and extends 3\sigma in either direction so the actual numbers used as axis labels are not necessarily “nice” in general.

Attached is some example code which (should):

  • Produce an histogram similar to a “real” one with sufficiently awkward axis labels and titles.
  • Plot the histogram, preserving the 1:1 aspect ratio.
  • Save the histogram as an eps.

The specific problems I’m having are:

  • The Y axis title overlaps the axis labels. If I increase the title offset then the title disappears entirely.
  • Some of the longer Y axis labels disappear from the eps file.
  • The key to the right of the plot sits on top of the axis multiplier. (The 10^{-3} in this case.)

Ideally I’d like:

  • The plot to remain square.
  • The plot to have some extra room at the left hand side in which to display the Y axis title
  • The plot to have some extra room at the right hand side in which to display the key.

Any help would be greatly appreciated.

Thanks in advance,

Paul.
ascii_plot.txt (416 Bytes)
example.C (1.61 KB)

You should increase the left pad margin to have more room. Use pad->SetLeftMargin() then you will have also to change the Top and Bottom margins to keep the pad square.

This is fixed since version 5.14.

The palette can be moved interactivelly.

Thank you very much for your speedy reply. I have since moved to v5.15 (as you may already have noticed from my other post).

You mentioned that it’s possible to move the palette interactively, however, I would ideally like to be able to move the palette from within a macro because I have to make many plots at once.

I’ve saved my canvas after I’ve moved the palette to a different position and it appears that the only difference is the line:

TPaletteAxis *palette = newTPaletteAxis(0.709316,-0.5773503,0.7851964,0.5773503,h_myHisto);

in the myCanvas.C file.

Unofrtunately I’ve been unable to re-run the myCanvas.C macro so that it exactly reproduces the plot I made earlier. (I’ve had to remove lines relating to the TView object since root complains about these.)

Can anyone tell me the exact lines I need to add to my macro (and their location) so that I can move the palette non-interactively?

Thanks,

Paul.
mycan.C (3.22 KB)

For some reason I do not understand yet, the pallette cannot be move with option cont4z. It seems it is due the fact the cont4 option is in fact a 3D surface seen from top. It works with other contour options and with colz.

By the way, I do not understand why you would like to move the palette. Your macro gives the following output which, seems to me, is good. The palette does not hide any thing.


Thanks for looking into this for me, as usual I’m impressed with how fast you Rooters try to resolve any given problem.

To answer your question regarding why I’d like to move the palette, it’s because in the “real life” situation the span of the x-axis is rather small so the axis labels need a 10^{-3} multiplier which then sits under the palette and is unreadable.

Here we are. Sorry to have been so long to solve your question that was fairly obvious in fact.



movepal.C (2.42 KB)

Thanks, that’s perfect.

Paul.