Scatter plot with vector associated to each point

Hi,

given a table of
(x,y,z,cx,cy,cz) where cx, cy, cz are the components of a unit vector,

I would like to make a plot that looks like this:

With the unit vector pointing out of its associated x,y,z coordinate.

Can anybody help me find the easiest way to do this? I have tried multiple ways but all are pretty awkward.

A big thank you to anybody who can help me!!

This suggestion is outside ROOT, but you might want to checkout pgfplots.

Here is a quiver plot example: http://pgfplots.net/tikz/examples/differential-equation/

There is a whole section on quiver plots in the pgfplots manual.

1 Like

Or you could try TGraphBentArrows and use one of the error bars as your vector.

1 Like

Thanks, TGraphBentArrows is a nice way for me to do it!

Hi ksmith,

What is the meaning of these variables in TGraphBentErrors:

https://root.cern.ch/doc/master/TGraphBentErrors_8h_source.html

33 Double_t *fEXlowd; ///<[fNpoints] array of X low displacements
34 Double_t *fEXhighd; ///<[fNpoints] array of X high displacements
35 Double_t *fEYlowd; ///<[fNpoints] array of Y low displacements
36 Double_t *fEYhighd; ///<[fNpoints] array of Y high displacements

I want to direct the x high error (which is a fixed length) at a certain angle theta, just as you would
direct a vector of length r at a certain angle theta.

How do I do it?

Thank you very much for any reply!

If for example I set the fEXhighd to be a constant for all points on my scatter plot, this affects the points differently: For all points I did the following

tgraph->SetPointError(counter1,0,0,0,50,0,0,0,0.5);
I am confused why the points have different errors when they were assigned the same constant value.

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