Use cetz for plotting #3

Open
opened 2024-10-02 11:18:41 +00:00 by Erik · 2 comments
Owner
https://typst.app/universe/package/cetz/
Erik added the
Fach
Mathe
label 2024-10-02 11:18:41 +00:00
Author
Owner

got some first samples:

#import "@preview/cetz:0.2.2"
#cetz.canvas({
  import cetz.draw: *
  import cetz.plot
  plot.plot(size: (2,2), x-tick-step: 2, y-tick-step: 2, x-equal: "y",
    {
      plot.add(((0,0), (1,1), (2,.5), (4,3)))
      plot.add(domain: (0, 2 * calc.pi),
        t => (calc.cos(t), calc.sin(t))
      )
    })
})

#cetz.canvas({
  import cetz.draw: *
  import cetz.plot
  plot.plot(size: (4, 4), x-tick-step: 1, y-tick-step: 1, 
    {
      plot.add(domain: (-2, 2),
        x => (x,  calc.pow(x, 2) )
      )
    })
})

however I have to:

  • fix autocompletion
got some first samples: ```typst #import "@preview/cetz:0.2.2" #cetz.canvas({ import cetz.draw: * import cetz.plot plot.plot(size: (2,2), x-tick-step: 2, y-tick-step: 2, x-equal: "y", { plot.add(((0,0), (1,1), (2,.5), (4,3))) plot.add(domain: (0, 2 * calc.pi), t => (calc.cos(t), calc.sin(t)) ) }) }) #cetz.canvas({ import cetz.draw: * import cetz.plot plot.plot(size: (4, 4), x-tick-step: 1, y-tick-step: 1, { plot.add(domain: (-2, 2), x => (x, calc.pow(x, 2) ) ) }) }) ``` however I have to: - [ ] fix autocompletion
Author
Owner

should use mdbook with typst-preprocessor for documentation

should use mdbook with [typst-preprocessor](https://github.com/sitandr/mdbook-typst-highlight) for documentation
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: Erik/typst#3
No description provided.