Line size with f(z)

Is there a way to set the line size of a trace using f(z)?  For only two sizes the best I've been able to come up with is to add the trace to the graph twice, set the traces to two different line sizes, and then use a color index wave to make portions of one trace transparent.  This is pretty awkward and only allows for two sizes.

 

Make/O/D/N=10000 Y_Values=sin(p/100)
Make/O/U/B/N=10000 Line_Size=Y_Values>=0
Make/O/D/N=(4,2) Color_Table={{0,0},{0,0},{0,0},{65535,0}}
Display Y_Values,Y_Values
ModifyGraph lsize(Y_Values)=3,rgb(Y_Values#1)=(0,0,0),zColor(Y_Values)={Line_Size,*,*,cindexRGB,0,Color_Table}

 

I didn't find a setting for the line size, but if the spacing of your data is small, then you can approximate this effect with f(z) to marker size and round markers.

Make/d/o/n=10000 testdata = p, linesize = p
Display testdata
ModifyGraph mode=3,marker=19,zmrkSize(testdata)={linesize,*,*,1,10}

 

I've done that in the past, but for this particular dataset markers didn't look as nice as lines.  Fortunately I only needed two sizes, so my hack with two traces worked.

There is another option, somewhat kludgy, but perhaps useful for a final pre-publication version. Simply convert the graphed wave segments into sequential draw-line objects and vary the line thickness in each segment. This will require you to set up x,y wave pairs for your wave vertices. The following example may be quick guide.

function foo(wx,wy)
    wave wx, wy
    variable np=dimsize(wx,0)
    variable i
    setdrawlayer/K userback
    setdrawlayer userback
    for(i=0;i<(np-1);i+=1)
        setdrawenv xcoord=bottom, ycoord=left, linethick=0.5*(i+1), linejoin=1
        drawline wx[i],wy[i],wx[i+1],wy[i+1]
    endfor
end

The first setdrawlayer/K clears the previous draw result and initializes the graph.

You might also want to explore better options (miter-join?) to clean up the ends, depending on the line thicknesses used. Igor has lots of wave drawing options, but none seem to offer variable line thicknesses. The example shows the x,y markers as well.

I might add that line thickness as f(z) may be somewhat problematic- I presume that what everyone would expect would be long, thin trapezoids with the correct thickness at each end. While theoretically feasible, it is quite a departure from what we have now (that is, would require quite a bit of pretty complicated new code) and the drawing performance would be very poor. The alternative would be to do it the way we do color as f(z): the color is set by the value at the starting end of the line and that color continues to the next data point. At the next data point a new color is set. So applying that to line thickness would result in a thickness set at one end and continuing to the next data point, where it would abruptly change thickness. Sounds kind of ugly to me :)

But it does seem like an obvious extension of our present color, marker size, and marker number as f(z). I'll file an enhancement request and we'll see...

I just had another sudden thought: prepare your f(z) wave as an error bar wave and use the option for shaded error region. You can make the trace itself zero thickness (I think) or at least use the same color for the trace and the error shading. You will need to play with scaling of the f(z) wave to get the desired effect.

Well, you can control the line width in Gizmo (see, for example, radius wave in Path object).