Home | News | Documentation | Download

ROOT Contours - How to set the line style

Hopefully a quick question about how to set the contour line style.

I tried TH2D->SetLineStyle(0) however this did not change the result.

Below is an image of what the contours should look like. These are produced by my analysis macro.


I have to run this macro twice, one with systematics enabled, the other with systematics disabled.

As this takes a long time to run, I have printed the values of the TH2 object to a text file. I am then reading this info back in with a new root macro.

However, the results are different - see below.

I don’t know why the lines are being drawn with dots instead of solid lines. I tried looking around in my analysis macro to see if I have accidentally set something which ensures they are drawn as solid lines, but could not find anything.

These contours are being drawn with "cont2same" drawing option. What should I do to change the line style of the contours?

cont2 draws the contours with automatically changing line styles, therefore you cannot change the line style as there is many. The option to use in cont3. It draws the contour with a single line style. It uses the line style you will set on the TH2.

Hi again, thanks for this. What parameters are used as the basis for the automatic decisions with cont2? (Just as a matter of interest and for future readers.)

Indeed changing to cont3same, and setting the line color and style (to zero) gives the anticipated result.


Future readers can check the documentation recently updated by this PR.

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