diff --git a/src/plot.typ b/src/plot.typ index 3b3c699..73d2b7f 100644 --- a/src/plot.typ +++ b/src/plot.typ @@ -299,13 +299,6 @@ } } - // Remove unused axes - for (k, v) in ctx.axes { - if not v.at("used", default: false) { - let _ = ctx.axes.remove(k) - } - } - // Set axis options ctx.axes = plot-util.setup-axes(cetz-ctx, ctx.axes, options.named(), size) diff --git a/src/plot/util.typ b/src/plot/util.typ index 9330afd..d0da859 100644 --- a/src/plot/util.typ +++ b/src/plot/util.typ @@ -297,9 +297,8 @@ axis.min = get-axis-option(name, "min", axis.min) axis.max = get-axis-option(name, "max", axis.max) - assert(axis.min not in (none, auto) and - axis.max not in (none, auto), - message: "Axis min and max must be set.") + if axis.min == none { axis.min = 0 } + if axis.max == none { axis.max = axis.min } if axis.min == axis.max { axis.min -= 1; axis.max += 1 } diff --git a/tests/axes/log-mode/ref/1.png b/tests/axes/log-mode/ref/1.png index 409c2c3..1f03da5 100644 Binary files a/tests/axes/log-mode/ref/1.png and b/tests/axes/log-mode/ref/1.png differ diff --git a/tests/chart/boxwhisker/ref/1.png b/tests/chart/boxwhisker/ref/1.png index 07b311a..a3e0142 100644 Binary files a/tests/chart/boxwhisker/ref/1.png and b/tests/chart/boxwhisker/ref/1.png differ diff --git a/tests/chart/ref/1.png b/tests/chart/ref/1.png index a9aab7b..5372a89 100644 Binary files a/tests/chart/ref/1.png and b/tests/chart/ref/1.png differ diff --git a/tests/plot/annotation/ref/1.png b/tests/plot/annotation/ref/1.png index af0ea9d..a62f40e 100644 Binary files a/tests/plot/annotation/ref/1.png and b/tests/plot/annotation/ref/1.png differ diff --git a/tests/plot/bar/ref/1.png b/tests/plot/bar/ref/1.png index 307100d..8a3a27a 100644 Binary files a/tests/plot/bar/ref/1.png and b/tests/plot/bar/ref/1.png differ diff --git a/tests/plot/boxwhisker/ref/1.png b/tests/plot/boxwhisker/ref/1.png index 2f1e16e..bf6dbbe 100644 Binary files a/tests/plot/boxwhisker/ref/1.png and b/tests/plot/boxwhisker/ref/1.png differ diff --git a/tests/plot/broken-axes/ref/1.png b/tests/plot/broken-axes/ref/1.png index fcd2e11..00a1653 100644 Binary files a/tests/plot/broken-axes/ref/1.png and b/tests/plot/broken-axes/ref/1.png differ diff --git a/tests/plot/contour/ref/1.png b/tests/plot/contour/ref/1.png index adad8ab..d1cf38f 100644 Binary files a/tests/plot/contour/ref/1.png and b/tests/plot/contour/ref/1.png differ diff --git a/tests/plot/equal-axis/ref/1.png b/tests/plot/equal-axis/ref/1.png index 7f4196f..f5d9d66 100644 Binary files a/tests/plot/equal-axis/ref/1.png and b/tests/plot/equal-axis/ref/1.png differ diff --git a/tests/plot/format/ref/1.png b/tests/plot/format/ref/1.png index 2b5a0ec..99ce0f8 100644 Binary files a/tests/plot/format/ref/1.png and b/tests/plot/format/ref/1.png differ diff --git a/tests/plot/grid/ref/1.png b/tests/plot/grid/ref/1.png index 550e9d5..2fef669 100644 Binary files a/tests/plot/grid/ref/1.png and b/tests/plot/grid/ref/1.png differ diff --git a/tests/plot/hvline/ref/1.png b/tests/plot/hvline/ref/1.png index 24fa4d3..c918eb2 100644 Binary files a/tests/plot/hvline/ref/1.png and b/tests/plot/hvline/ref/1.png differ diff --git a/tests/plot/legend/ref/1.png b/tests/plot/legend/ref/1.png index def865f..b303443 100644 Binary files a/tests/plot/legend/ref/1.png and b/tests/plot/legend/ref/1.png differ diff --git a/tests/plot/line/between/ref/1.png b/tests/plot/line/between/ref/1.png index 8fba9e2..9e14aa7 100644 Binary files a/tests/plot/line/between/ref/1.png and b/tests/plot/line/between/ref/1.png differ diff --git a/tests/plot/line/fill/ref/1.png b/tests/plot/line/fill/ref/1.png index 09a108f..e472270 100644 Binary files a/tests/plot/line/fill/ref/1.png and b/tests/plot/line/fill/ref/1.png differ diff --git a/tests/plot/line/line-type/ref/1.png b/tests/plot/line/line-type/ref/1.png index 7814191..a4e49b1 100644 Binary files a/tests/plot/line/line-type/ref/1.png and b/tests/plot/line/line-type/ref/1.png differ diff --git a/tests/plot/line/linearization/ref/1.png b/tests/plot/line/linearization/ref/1.png index ea8c022..058152f 100644 Binary files a/tests/plot/line/linearization/ref/1.png and b/tests/plot/line/linearization/ref/1.png differ diff --git a/tests/plot/line/mark/ref/1.png b/tests/plot/line/mark/ref/1.png index f4e7ca6..d501585 100644 Binary files a/tests/plot/line/mark/ref/1.png and b/tests/plot/line/mark/ref/1.png differ diff --git a/tests/plot/line/spline/ref/1.png b/tests/plot/line/spline/ref/1.png index ba6e25b..5225101 100644 Binary files a/tests/plot/line/spline/ref/1.png and b/tests/plot/line/spline/ref/1.png differ diff --git a/tests/plot/marks/ref/1.png b/tests/plot/marks/ref/1.png index ad6e334..31121a6 100644 Binary files a/tests/plot/marks/ref/1.png and b/tests/plot/marks/ref/1.png differ diff --git a/tests/plot/mirror-axes/ref/1.png b/tests/plot/mirror-axes/ref/1.png index 4e7e062..5078d01 100644 Binary files a/tests/plot/mirror-axes/ref/1.png and b/tests/plot/mirror-axes/ref/1.png differ diff --git a/tests/plot/parametric/ref/1.png b/tests/plot/parametric/ref/1.png index 18557d3..2b86bbf 100644 Binary files a/tests/plot/parametric/ref/1.png and b/tests/plot/parametric/ref/1.png differ diff --git a/tests/plot/ref/1.png b/tests/plot/ref/1.png index 2cfb1b8..ef58f3c 100644 Binary files a/tests/plot/ref/1.png and b/tests/plot/ref/1.png differ diff --git a/tests/plot/reverse-axis/ref/1.png b/tests/plot/reverse-axis/ref/1.png index d29c1b6..e53e47d 100644 Binary files a/tests/plot/reverse-axis/ref/1.png and b/tests/plot/reverse-axis/ref/1.png differ diff --git a/tests/plot/test.typ b/tests/plot/test.typ index 9ea7b68..4cf0944 100644 --- a/tests/plot/test.typ +++ b/tests/plot/test.typ @@ -136,6 +136,10 @@ yb-min: -1.5, yb-max: .5, yt-min: -.5, yt-max: 1.5, { + plot.add-cartesian-axis("xl", (0, 0), (4, 0)) + plot.add-cartesian-axis("xr", (0, 4), (4, 4)) + plot.add-cartesian-axis("yt", (0, 0), (0, 4)) + plot.add-cartesian-axis("yb", (4, 0), (4, 4)) plot.add(circle-data) plot.add(circle-data, axes: ("xl", "y"), style: (stroke: green)) plot.add(circle-data, axes: ("xr", "y"), style: (stroke: red)) @@ -155,6 +159,10 @@ yb-min: -1.75, yb-max: .25, yt-min: -.25, yt-max: 1.75, { + plot.add-cartesian-axis("xl", (0, 0), (4, 0)) + plot.add-cartesian-axis("xr", (0, 4), (4, 4)) + plot.add-cartesian-axis("yt", (0, 0), (0, 4)) + plot.add-cartesian-axis("yb", (4, 0), (4, 4)) plot.add(circle-data) plot.add(circle-data, axes: ("xl", "y"), style: (stroke: green)) plot.add(circle-data, axes: ("xr", "y"), style: (stroke: red)) diff --git a/tests/plot/vertical/ref/1.png b/tests/plot/vertical/ref/1.png index f034306..3b29739 100644 Binary files a/tests/plot/vertical/ref/1.png and b/tests/plot/vertical/ref/1.png differ diff --git a/tests/plot/violin/ref/1.png b/tests/plot/violin/ref/1.png index 63e1210..4e5cf54 100644 Binary files a/tests/plot/violin/ref/1.png and b/tests/plot/violin/ref/1.png differ