I am wondering if it’s possible to plot a TGraph2D in a “line” form in 2D, using a changing colour of the line as if it was the “Z-axis”.
Example: I have a set of (x,y,z).
I can draw them in 3D, with the option “P”, and I see a curve.
It would be great (if possible) to collapse this into a 2D (like a simple TGraph), where the colour of the line is a representation of the Z-component.
Something similar can be performed with a TH2F and “colz” option, but some nice features of TGraph are lost there (like the line width to better see the line).
I understand the ambiguity in the case we have 2 points with the same X,Y and different Z, but an option like “maximum of Z” or “minimum of Z” could be added in that case.
If possible, this would be a nice feature for visualization.
I understand the way to connect to points to produce the line is definitely not trivial. I was thinking naively to something like the natural ordering that can be obtained with “GetX()” (Y, Z) methods.
A simple workaround I did (but still using TH2F) is in the following: