# Change the thickness (or opacity) of a line as a function?

I’m wanting a line to get thinner and the opacity to decrease as x increases. Seems like that should be possible but I am not figuring it out!

You can include a function in the line thickness and line opacity settings that apply to the line as a whole, but I don’t think a single line can have varying thickness / opacity.

The only way I can think of to do this would be to use a series of piecewise functions for various values of x, and adjust the thickness and opacity of each accordingly.

1 Like

I agree that this isn’t possible the way you describe. Another workaround that I can think of would be to make a 10,000 point list and apply the functions to the points as you described. I haven’t tried it, but I would guess the quantity of points would make the function appear continuous.

3 Likes

Great thinking @cwinske ! Takes a few lines but gives the effect that presumably the OP was looking for:

3 Likes

Late to the show, but I think this is neat:

It is also possible to split a function into a list of piecewise parts (based on a z function) and then assign color, width, or transparency using a list.

You can also use this to have lines weave over and under each other by sorting them based on the Z values, so the front ones overdraw the back pieces.

Hi. I’m trying to create an opacity gradient in the fill slot, for a double inequality: 0.793 <= y <= 0.9991
How could I do it?