-
Hey, I'm pretty much just getting started with cetz, but I'm having some trouble getting the Here's what I'm doing: #import "@preview/charged-ieee:0.1.0": ieee
#import "@preview/cetz:0.2.2": *
//...
#canvas(length: 0.8cm, {
plot.plot(size: (8, 6),
y-label: "Durability",
x-label: "Time",
x-tick-step: none,
y-min: 0,
{
plot.add(((0,40), (5,50), (10, 50), (15, 60), (20, 60), (25, 70)))
plot.annotate({
rect((5, 0), (10, 100), fill: rgb(50, 50, 200, 50))
content((5, 0), [Here])
})
})
}) But I keep getting What am I doing wrong? edit: this seems to be working better, but I still get errors: #import "@preview/cetz:0.2.2"
// ...
#cetz.canvas(length: 0.8cm, {
import cetz.plot
import cetz.draw: *
plot.plot(size: (8, 6),
y-label: "Durability",
x-label: "Time",
x-tick-step: none,
y-min: 0,
{
plot.add(((0,40), (5,50), (10, 50), (15, 60), (20, 60), (25, 70)))
plot.add-anchor("fail1", (5, 50))
plot.annotate({
rect((5, 0), (10, 100), fill: rgb(50, 50, 200, 50))
content((5, 0), [Here])
})
})
line("plot.fail1", ((), "|-", (0,1.5)), mark: (start: ">"), name: "line")
})
If I remove the draw import, the edit2: Ohh, the failure is because "plot" doesn't refer to the "plot" namespace, it refers to an user-defined thing named "plot", which I missed in the example. What a ride. I think it's working now. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
You want to make sure you import the correct functions and modules at the start of the canvas:
To use
|
Beta Was this translation helpful? Give feedback.
You want to make sure you import the correct functions and modules at the start of the canvas:
To use
"plot.fail1"
as an anchor you need to give the plot a name using thename
keyword argument