Skip to content

Commit 6af8777

Browse files
committed
WIP
1 parent c674903 commit 6af8777

File tree

25 files changed

+19
-12
lines changed

25 files changed

+19
-12
lines changed

src/plot.typ

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
target: target,
3939
min: none,
4040
max: none,
41-
ticks: (step: auto, minor-step: none, format: none, list: ())
41+
ticks: (step: auto, minor-step: none, format: "float", list: ())
4242
)
4343
ctx.axes.insert(name, axis)
4444
return ctx
@@ -299,13 +299,6 @@
299299
}
300300
}
301301

302-
// Remove unused axes
303-
for (k, v) in ctx.axes {
304-
if not v.at("used", default: false) {
305-
let _ = ctx.axes.remove(k)
306-
}
307-
}
308-
309302
// Set axis options
310303
ctx.axes = plot-util.setup-axes(cetz-ctx, ctx.axes, options.named(), size)
311304

src/plot/util.typ

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -290,16 +290,22 @@
290290
}
291291

292292
for (name, axis) in axis-dict {
293+
let used = axis.at("used", default: false)
294+
293295
if not "ticks" in axis { axis.ticks = () }
294-
axis.label = get-axis-option(name, "label", $#name$)
296+
axis.label = get-axis-option(name, "label", if used { $#name$ } else { axis.at("label", default: none) })
295297

296298
// Configure axis bounds
297299
axis.min = get-axis-option(name, "min", axis.min)
298300
axis.max = get-axis-option(name, "max", axis.max)
299301

300-
assert(axis.min not in (none, auto) and
301-
axis.max not in (none, auto),
302-
message: "Axis min and max must be set.")
302+
if axis.min == none {
303+
axis.min = 0
304+
axis.ticks.step = none
305+
axis.ticks.minor-step = none
306+
axis.ticks.format = none
307+
}
308+
if axis.max == none { axis.max = axis.min }
303309
if axis.min == axis.max {
304310
axis.min -= 1; axis.max += 1
305311
}

tests/axes/log-mode/ref/1.png

-1.55 KB
Loading

tests/chart/boxwhisker/ref/1.png

-172 Bytes
Loading

tests/chart/ref/1.png

197 Bytes
Loading

tests/plot/annotation/ref/1.png

4.65 KB
Loading

tests/plot/bar/ref/1.png

-141 Bytes
Loading

tests/plot/boxwhisker/ref/1.png

-1.27 KB
Loading

tests/plot/broken-axes/ref/1.png

-1.07 KB
Loading

tests/plot/contour/ref/1.png

-1.07 KB
Loading

0 commit comments

Comments
 (0)