Skip to content

Commit

Permalink
tests: Add test for rotated annotation
Browse files Browse the repository at this point in the history
  • Loading branch information
johannes-wolf committed Sep 8, 2024
1 parent 4c6d585 commit c091118
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
Binary file modified tests/plot/annotation/ref/1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions tests/plot/annotation/test.typ
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,24 @@
})
})
})

#test-case({
import draw: *
set-style(rect: (stroke: none))

plot.plot(size: (6, 4), x-horizontal: false, y-horizontal: true, {
plot.add(domain: (-calc.pi, 3*calc.pi), calc.sin)
plot.annotate(background: true, {
rect((0, -1), (calc.pi, 1), fill: blue.lighten(90%))
rect((calc.pi, -1.1), (2*calc.pi, 1.1), fill: red.lighten(90%))
rect((2*calc.pi, -1.5), (3.5*calc.pi, 1.5), fill: green.lighten(90%))
})
plot.annotate(padding: .1, {
line((calc.pi / 2, 1.1), (rel: (0, .2)), (rel: (2*calc.pi, 0)), (rel: (0, -.2)))
content((calc.pi * 1.5, 1.5), $ lambda $)
})
plot.annotate(padding: .1, {
line((calc.pi / 2,-.1), (calc.pi / 2, .8), mark: (end: "stealth"))
})
})
})

0 comments on commit c091118

Please sign in to comment.