diff --git a/src/axes.typ b/src/axes.typ index 34ce66b..ef34cc7 100644 --- a/src/axes.typ +++ b/src/axes.typ @@ -343,6 +343,7 @@ if "minor-step" in ticks and ticks.minor-step != none { assert(ticks.minor-step >= 0, message: "Axis minor tick step must be positive") + if axis.min > axis.max { ticks.minor-step *= -1 } let s = 1 / ticks.minor-step diff --git a/tests/axes/ref/1.png b/tests/axes/ref/1.png index ddf820d..a7ed6a5 100644 Binary files a/tests/axes/ref/1.png and b/tests/axes/ref/1.png differ diff --git a/tests/axes/test.typ b/tests/axes/test.typ index e517c22..70bf522 100644 --- a/tests/axes/test.typ +++ b/tests/axes/test.typ @@ -1,7 +1,7 @@ #set page(width: auto, height: auto) -#import "/src/lib.typ": * -#import "/src/cetz.typ": * #import "/tests/helper.typ": * +#import cetz: draw +#import cetz-plot: axes // Schoolbook Axis Styling #test-case({ @@ -57,3 +57,13 @@ )), left: axes.axis(min: -1, max: 1, ticks: (step: none, minor-step: none))) }) + +// #10 - Minor ticks on reversed axis +#test-case({ + import draw: * + + axes.scientific(size: (6, 1), + bottom: axes.axis(min: 5, max: -5, + ticks: (step: 5, minor-step: 1)), + left: axes.axis(min: -1, max: 1, ticks: (step: none, minor-step: none))) +})