How to plot x variable in vertical axis and y variable in horizontal axis?

Let’s consider TF1 f1(“func”,“sin(x)”,0,6.28); f1.Draw();

This will draw y=sin(x)

How to draw the x variable in vertical axis and the y variable in horizontal axis ? (I don’t wish to especially write y=asin(x) : I really wish to draw the x in the vertical axis and the y in the horizontal axis)


Please read tips for efficient and successful posting and posting code

ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided


One way would be to fill a TGraph with the points (sin(x), x)

Thank you Olivier. This solution is fine for me. Do you confirm that else, with a TF1 (and not doing the “reverse” function f^{-1}), there is no other way (not feasible with root to switch x and y axis) ?

Yes, with TF1 the X axis is always horizontal. I confirm.

Thank you Olivier. Your comments have been extremely important. I flag now your previous reply as “solution”. Thanks

1 Like

Sure. I am happy it helps you.

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