Reputation: 11
I am trying to generate a plot which uses arrows as markers in Gnuplot. These arrows I want to turn in a specific angle which I know. So I have value triples of x1 ... xn, y1...yn, alpha1...alphan. Sorry, I wasn't able to include a pic from my hard drive to illustrate what I want to achieve.
Basically, for every (15th or so) x-y pair, the marker should be an arrow which uses a certain angle.
The measured data is tightly packed so I suppose I will have to define an increment between the markers. The length of the arrow can be the same all over.
I would appreciate your ideas.
Upvotes: 1
Views: 634
Reputation: 25023
Gnuplot has a plot mode with vectors
that is what you want
Given that your file has the following format, x y angle
and assuming that
your angle is in radians, you have to take into account that
with vectors
requires 4 parameters, namely x y dx dy
where dx
and dy
are the projections of the lenght of the arrow.
this draws only the arrows, if you want a line you have to make two passes on the data.
you want to draw an arrow for a data point over, say, 10 points.
That said, I'd proceed like this
dx(a) = 0.2*cos(a) # 0.2 is an arbitrary scaling factor
dy(a) = 0.2*sin(a)
# this draws the arrows
plot 'mydata.dat' every 10 using 1:2:(dx(a)):(dy(a)) with vectors
# this draws the line
plot 'mydata.dat'
You may want to use help plot
to find the detailed explanation of all the parameters that you can apply to a with vectors
plot.
Credits: An article on the gnuplotting site
Upvotes: 1