Skip to content

Commit

Permalink
plot: Annotation add example
Browse files Browse the repository at this point in the history
  • Loading branch information
johannes-wolf committed Dec 2, 2023
1 parent eb3d496 commit cfb1839
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/lib/plot/annotation.typ
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,21 @@
/// An annotation is a sub-canvas that uses the plots coordinates specified
/// by its x and y axis.
///
/// #example(```
/// cetz.plot.plot(size: (2,2), {
/// plot.add(domain: (0, 2*calc.pi), calc.sin)
/// plot.add-annotation({
/// rect((0, -1), (calc.pi, 1), fill: rgb(50,50,200,50))
/// })
/// })
/// ```)
///
/// Bounds calculation is done naively, therefore fixed size content _can_ grow
/// out of the plot. You can adjust the padding manually to adjust for that. The
/// feature of solving the correct bounds for fixed size elements might be added
/// in the future.
///
/// - body (drawable): CeTZ Draw commands
/// - body (drawable): Elements to draw
/// - axes (axes): X and Y axis names
/// - resize (bool): If true, the plots axes get adjusted to contain the annotation
/// - padding (none,number,dictionary): Annotation padding that is used for axis
Expand Down
Binary file modified tests/plot/annotation/ref.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit cfb1839

Please sign in to comment.