if the arrow length is reduced to small values towards zero the arrow

head is also changing. Actually, I would have expected that the arrow

heads stay always the same. But they are not as you can easily check

with the following code.

####### Test arrows

reset

set xrange[0:20]

set yrange[0:3]

do for [i=1:20] {

set arrow 3*i from i,0 to i,i/50.

set arrow 3*i+1 from i,1 to i,1+i/50. head size 1,15,45 filled

set arrow 3*i+2 from i,2 length i/10. angle 90 head size 1,15,45 filled

}

plot 0 notitle

######

I guess that's not want you wanted for your arrow heads?!

So, I thought arrow heads can also be created by polygons.

set object 1 polygon from x1,y1 to x2,y2 to ... to x1,y1

The following code is a "workaround" just for fun...

It looks (and maybe is) complicated but basically it's just a few

coordinate transformations.

The necessary input parameters for the arrow heads are the following:

ax = 0 # x-value in x1-axis coordinates arrow head points to

ay = 0 # y-value in y1-axis coordinates arrow head points to

AA = 45 # ArrowAngle

HL = 0.05 # HeadLength in fractions of screen width

HA = 15 # HeadAngle

BA = 45 # BackAngle

There might be certainly a more elegant way to do it.

Hope there is no bug in it, but it worked for me on a wxt terminal.

The size and shape of the arrow heads do do not depend on the graph

scale but just on the screen.

####### Test_Arrow2.plt

####### Arrow heads without shaft realized with polygons

reset

set xrange[-10:10]

set yrange[-10:10]

set size square

set angle degrees

# needs to plot something to update the range and GPVAL_ values?!

plot 0 notitle

# setting of arrow parameters

ax = 0 # x-value in x1-axis coordinates arrow head points to

ay = 0 # y-value in y1-axis coordinates arrow head points to

AA = 45 # ArrowAngle

HL = 0.05 # HeadLength in fraction of screen width

HA = 15 # HeadAngle

BA = 45 # BackAngle

# define a few coordinate functions

aFracX(xx) = (xx - GPVAL_X_MIN) / ((GPVAL_X_MAX - GPVAL_X_MIN))

aFracY(yy) = (yy - GPVAL_Y_MIN) / ((GPVAL_Y_MAX - GPVAL_Y_MIN))

aFracScrX(xx)= (GPVAL_TERM_XMIN + aFracX(xx)\

*(GPVAL_TERM_XMAX - GPVAL_TERM_XMIN))/GPVAL_TERM_XSIZE

aFracScrY(yy) = (GPVAL_TERM_YMIN + aFracY(yy)\

*(GPVAL_TERM_YMAX - GPVAL_TERM_YMIN))/GPVAL_TERM_YSIZE

# necessary to scale with aspect ratio of terminal

# +0.0 to force floating point divison

AAspect = GPVAL_TERM_XSIZE / (GPVAL_TERM_YSIZE +0.0)

# more coordinate transformation functions

a1x(ax,AA,HL,HA) = aFracScrX(ax) + HL/cos(HA)*cos(180-HA+AA)

a1y(ay,AA,HL,HA) = aFracScrY(ay) + HL/cos(HA)*sin(180-HA+AA)*AAspect

a2x(ax,AA,HL,HA,BA) = aFracScrX(ax) + HL\

*(1-tan(HA)/tan(BA))*cos(180+AA)

a2y(ay,AA,HL,HA,BA) = aFracScrY(ay) + HL\

*(1-tan(HA)/tan(BA))*sin(180+AA)*AAspect

a3x(ax,AA,HL,HA) = aFracScrX(ax) + HL/cos(HA)*cos(180+HA+AA)

a3y(ay,AA,HL,HA) = aFracScrY(ay) + HL/cos(HA)*sin(180+HA+AA)*AAspect

# here comes the loop to create a few arrow heads

do for [i=1:8] {

AA = i*45 # ArrowAngle 0° points to the right

ax = 8*cos(i*45)

ay = 8*sin(i*45)

set object i polygon \

from screen aFracScrX(ax),aFracScrY(ay) \

to screen a1x(ax,AA,HL,HA),a1y(ay,AA,HL,HA) \

to screen a2x(ax,AA,HL,HA,BA),a2y(ay,AA,HL,HA,BA) \

to screen a3x(ax,AA,HL,HA),a3y(ay,AA,HL,HA) \

to screen aFracScrX(ax),aFracScrY(ay) \

fillstyle solid fc rgb "red"

}

# plot something to visualize the objects

plot 0 notitle

####### EOF

------------------------------------------------------------------------------

_______________________________________________

gnuplot-info mailing list

[hidden email]
Membership management via:

https://lists.sourceforge.net/lists/listinfo/gnuplot-info