Skip to content

Commit

Permalink
plot: Fix mark axis handling
Browse files Browse the repository at this point in the history
  • Loading branch information
johannes-wolf committed Oct 19, 2024
1 parent b8df2e3 commit ccc1a98
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
9 changes: 8 additions & 1 deletion src/plot.typ
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,14 @@
})

if "mark" in d and d.mark != none {
draw.group({
draw.scope({
if y.horizontal {
draw.set-ctx(ctx => {
ctx.transform = matrix.swap-cols(ctx.transform, 0, 1)
return ctx
})
}

draw.set-style(..d.style, ..d.mark-style)
mark.draw-mark(d.data, x, y, d.mark, d.mark-size, size)
})
Expand Down
1 change: 1 addition & 0 deletions src/plot/boxwhisker.typ
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@
) + (if "outliers" in data { (
type: "boxwhisker-outliers",
data: data.outliers.map(it => (data.x, it)),
axes: axes,
mark: mark,
mark-size: mark-size,
mark-style: (:)
Expand Down
13 changes: 12 additions & 1 deletion tests/plot/boxwhisker/test.typ
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,23 @@

plot.plot(size: (10, 10),
y-min: 0,
y-max: 100,
y-max: 80,
{
plot.add-boxwhisker((x: 1, ..box1))
})
})

#test-case({
import draw: *

plot.plot(size: (10, 10),
x-min: 0,
x-max: 80,
{
plot.add-boxwhisker((x: 1, ..box1), axes: ("y", "x"))
})
})

#test-case({
import draw: *

Expand Down

0 comments on commit ccc1a98

Please sign in to comment.