cetz-plot
cetz-plot copied to clipboard
Gradients inappropriately applied to plot lines
I might be misunderstanding how to apply gradients to lines, but the following does not behave as I would expect.
#import "@preview/cetz:0.4.2": canvas, draw
#import "@preview/cetz-plot:0.1.3": plot
#canvas({
import draw: *
plot.plot(
size: (3,3),
axis-style: "scientific-auto",
y-tick-step: 1,
x-tick-step: 1,
{
plot.add(((0,0), (1,1)), style: (stroke: (paint: gradient.linear(black, red, black), thickness: 2pt)))
}
)
})
There is a small amount of red at the bottom corner, but that is it.
Setting relative: "parent" in the gradient works better, but does not apply to the full length of the line, with the center of the gradient being at the center of the whole plot plus axes instead of the center of the line.