Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I put comments into long plot commands?

Tags:

gnuplot

My gnuplot plot command is

tM=1.0*(a0*xmax+ymax)
set parametric
set trange [-0.2:tM]
plot  1/0,1/0 title '\ict\qquad' lc rgb 'gray80' dt 5 lw 2,\
uldx0(t),uldy0(t) title '\disct' lc rgb 'web-green' lw 3,\
hpx0(t),hpy0(t) lc rgb 'pink'  lw 2,\
 vpx0(t),vpy0(t) with filledcurve xy= 0.5*(xmi0+xpl0),0\
 fs transparent solid 0.25 fc rgb 'cyan' ,\
for [n=1:5] ix0(n*0.05+t*n*0.005/tM ,u0(0,n*0.05)),\
iy0(n*0.05+t*n*0.005/tM,u0(0,n*0.05))\
 lc rgb 'gray80' dt 5 lw 2,\
for [n=6:10] ix0(n*0.05+t*n*0.01/tM ,u0(0,n*0.05)),\
iy0(n*0.05+t*n*0.01/tM,u0(0,n*0.05))\
 lc rgb 'gray80' dt 5 lw 2,\
  for [n=22:36] ix0(n*0.025+t ,u0(0,n*0.025)),\
iy0(n*0.025+t,u0(0,n*0.025))\
lc rgb 'gray80' dt 5 lw 2,\
x0(t*pmax0(q1)/tM,q1), y0(t*pmax0(q1)/tM,q1)  \
 lc rgb q1color lw 2,\
x0(t*pmax0(ql0)/tM,ql0),  y0(t*pmax0(ql0)/tM,ql0)  \
 lc rgb qlcolor lw 2,\
x0(t*pmax0(QqxyL0)/tM,QqxyL0), y0(t*pmax0(QqxyL0)/tM,QqxyL0)  \
 lc rgb qhatmicolor lw 2,\
x0(t*pmax0(q2)/tM,q2) ,  y0(t*pmax0(q2)/tM,q2)  \
 lc rgb q2color lw 2,\
x0(t*pmax0(qpl0)/tM,qpl0), y0(t*pmax0(qpl0)/tM,qpl0)   \
 lc rgb qplcolor lw 2,\
x0(t*pmax0(QqxyR0)/tM,QqxyR0), y0(t*pmax0(QqxyR0)/tM,QqxyR0)  \
 lc rgb qhatplcolor lw 2

Is there a good way to break this up with comments which would also help may should I decide to look at this later?

like image 741
Edwin Franks Avatar asked Mar 28 '26 23:03

Edwin Franks


1 Answers

All inside a single plot command, right? I think the closest is to take advantage of the fact that each clause of a plot command can start with a definition. The intended use is something like plot a=2 x**a, but you could pick some junk variable and assign it to a comment string

plot \
    _c="Straight line" x   title _c, \
    _c="Parabola" x**2     title 'x^2', \
    _c="Some weird function" real(sinh(sqrt(x))) title 'squint(x)'

If you like you can use that comment string in the plot title, which is something close to the originally intended use. But also you can just ignore it in the plot clause. It would then only be relevant to someone reading the source, not to the output from the plot command.

like image 102
Ethan Avatar answered Apr 02 '26 22:04

Ethan