Skip to content

Filling the region between two curves in Cartesian math plot #418

Answered by johannes-wolf
psads-git asked this question in Q&A
Discussion options

You must be logged in to vote

You can use the 0.2.0 branch (or wait for the 0.2.0 release), which includes a plot.add-fill-between function which does the filling you want. For the intersections, you have to place them yourself right now, by adding another plot with no lines (stroke: none), but marks: mark: "o" and your intersection points as data (list of points).

  • Cross axes at (0,0): axis-style: "school-book" should do what you want.
  • Tick frequency: x-tick-step: <your-delta>. If you want additional tick marks without labels, you can enable minor ticks, by setting x-minor-tick-step: .. to some value.

Example:

#cetz.canvas({
  import cetz.plot
  import cetz.palette

  plot.plot(size: (4,4),
    x-tick-step: 2,
    x…

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@johannes-wolf
Comment options

@psads-git
Comment options

@johannes-wolf
Comment options

@psads-git
Comment options

Answer selected by psads-git
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants