Draw Y-axis TGraph


ROOT Version: 6.08.06-c8fb4
Platform: lyplus machines
Compiler: x86_64-slc6-gcc62-opt


Dear ROOT experts,
my issue is that I want to draw an plot with horizontal bars.
I have already started with TH1D and no solution has been found
https://root-forum.cern.ch/t/draw-y-axis-histograms-hbar-option-not-satisfying/32307/11

I have been told to use TGraph and I have done this simple example

import ROOT as r
import math
from array import array

n=20
x, y = array( 'd' ), array( 'd' )
for i in range(n):
  x.append(i*0.1)
  y.append(10.*math.sin(x[i]+0.2))
gr1 = r.TGraph(n,x,y)
gr1.Draw("AB")

and with this code I obtain this plot

then I have to switch X and Y axis

gr1 = r.TGraph(n,y,x)

and I get


:sob::sob::sob: this is clearly not what I want.
What I want is this (I have done a rotate right of the pdf of the 1st plot)

How can I achieve this please ???
Cheers, David.

I think the only simple way (referring back to the previous thread) with be to implement the HBAR option with line drawing. They are now implemented only with filled polygon.

I am sorry I don’t understand your point.
In between, I have abandonned my initial plan because I have lost enough time to achieve such simple thing, that seems to not be handled by ROOT.
So I am using SetFillStyle(3365) to replace the dashed-line-empty histograms. It is not beautiful but it works easily.

The line attribute are not supported by the HBAR option right now. Simply ignored. I am looking at that. With the current root you need to find a other solution (like the one you found).

Now fixed. See:

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