diff --git a/README.md b/README.md index 8ab8dac..76630c2 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ CeTZ-Plot is a library that adds plots and charts to [CeTZ](https://github.com/cetz-package/cetz), a library for drawing with [Typst](https://typst.app). -CeTZ-Plot requires CeTZ version ≥ 0.4.0! +CeTZ-Plot requires CeTZ version ≥ 0.4.2! ## Examples @@ -63,8 +63,8 @@ For information, see the [manual (stable)](https://github.com/cetz-package/cetz- To use this package, simply add the following code to your document: ``` -#import "@preview/cetz:0.4.0" -#import "@preview/cetz-plot:0.1.2": plot, chart +#import "@preview/cetz:0.4.2" +#import "@preview/cetz-plot:0.1.3": plot, chart #cetz.canvas({ // Your plot/chart code goes here diff --git a/gallery/barchart.png b/gallery/barchart.png index 9744356..572cf00 100644 Binary files a/gallery/barchart.png and b/gallery/barchart.png differ diff --git a/gallery/barchart.typ b/gallery/barchart.typ index a83d16a..88fec52 100644 --- a/gallery/barchart.typ +++ b/gallery/barchart.typ @@ -1,5 +1,5 @@ -#import "@preview/cetz:0.4.0": canvas, draw -#import "@preview/cetz-plot:0.1.2": chart +#import "@preview/cetz:0.4.2": canvas, draw +#import "@preview/cetz-plot:0.1.3": chart #set page(width: auto, height: auto, margin: .5cm) diff --git a/gallery/bending.typ b/gallery/bending.typ index 0a41c28..309ef95 100644 --- a/gallery/bending.typ +++ b/gallery/bending.typ @@ -1,4 +1,4 @@ -#import "@preview/cetz:0.4.0" as cetz: draw +#import "@preview/cetz:0.4.2" as cetz: draw #import "/src/lib.typ": smartart #set page(width: auto, height: auto, margin: .5cm) diff --git a/gallery/chevron.typ b/gallery/chevron.typ index 5345693..4956b38 100644 --- a/gallery/chevron.typ +++ b/gallery/chevron.typ @@ -1,4 +1,4 @@ -#import "@preview/cetz:0.4.0" as cetz: draw +#import "@preview/cetz:0.4.2" as cetz: draw #import "/src/lib.typ": smartart #set page(width: auto, height: auto, margin: .5cm) diff --git a/gallery/circular.typ b/gallery/circular.typ index 131b189..aea10c0 100644 --- a/gallery/circular.typ +++ b/gallery/circular.typ @@ -1,4 +1,4 @@ -#import "@preview/cetz:0.4.0" as cetz: draw +#import "@preview/cetz:0.4.2" as cetz: draw #import "/src/lib.typ": smartart #set page(width: auto, height: auto, margin: .5cm) diff --git a/gallery/cycles.typ b/gallery/cycles.typ index dd87b1e..c07c5b0 100644 --- a/gallery/cycles.typ +++ b/gallery/cycles.typ @@ -1,4 +1,4 @@ -#import "@preview/cetz:0.4.0": canvas, draw +#import "@preview/cetz:0.4.2": canvas, draw #import "/src/lib.typ": smartart #set page(width: auto, height: auto, margin: .5cm) diff --git a/gallery/line.png b/gallery/line.png index 4686bc1..c8babfa 100644 Binary files a/gallery/line.png and b/gallery/line.png differ diff --git a/gallery/line.typ b/gallery/line.typ index 31566b2..83b9297 100644 --- a/gallery/line.typ +++ b/gallery/line.typ @@ -1,5 +1,5 @@ -#import "@preview/cetz:0.4.0": canvas, draw -#import "@preview/cetz-plot:0.1.2": plot +#import "@preview/cetz:0.4.2": canvas, draw +#import "@preview/cetz-plot:0.1.3": plot #set page(width: auto, height: auto, margin: .5cm) diff --git a/gallery/piechart.typ b/gallery/piechart.typ index 3d56795..a391825 100644 --- a/gallery/piechart.typ +++ b/gallery/piechart.typ @@ -1,5 +1,5 @@ -#import "@preview/cetz:0.4.0" -#import "@preview/cetz-plot:0.1.2": chart +#import "@preview/cetz:0.4.2" +#import "@preview/cetz-plot:0.1.3": chart #set page(width: auto, height: auto, margin: .5cm) @@ -24,6 +24,7 @@ value-key: 1, label-key: none, radius: 4, + stroke: none, slice-style: colors, inner-radius: 1, outset: 3, diff --git a/gallery/process.typ b/gallery/process.typ index 5a1657d..294c46b 100644 --- a/gallery/process.typ +++ b/gallery/process.typ @@ -1,4 +1,4 @@ -#import "@preview/cetz:0.4.0" as cetz: draw +#import "@preview/cetz:0.4.2" as cetz: draw #import "/src/lib.typ": smartart #set page(width: auto, height: auto, margin: .5cm) diff --git a/gallery/pyramid.typ b/gallery/pyramid.typ index 94dc992..89fef14 100644 --- a/gallery/pyramid.typ +++ b/gallery/pyramid.typ @@ -1,5 +1,5 @@ -#import "@preview/cetz:0.4.0" -#import "@preview/cetz-plot:0.1.2": chart +#import "@preview/cetz:0.4.2" +#import "@preview/cetz-plot:0.1.3": chart #set page(width: auto, height: auto, margin: .5cm) diff --git a/manual.pdf b/manual.pdf index 4a9a1eb..8e7056c 100644 Binary files a/manual.pdf and b/manual.pdf differ diff --git a/manual.typ b/manual.typ index a891cc9..03d0ffa 100644 --- a/manual.typ +++ b/manual.typ @@ -42,8 +42,8 @@ CeTZ-Plot is a simple plotting library for use with CeTZ. This is the minimal starting point: #pad(left: 1em)[```typ -#import "@preview/cetz:0.4.0" -#import "@preview/cetz-plot:0.1.2" +#import "@preview/cetz:0.4.2" +#import "@preview/cetz-plot:0.1.3" #cetz.canvas({ import cetz.draw: * import cetz-plot: * diff --git a/src/axes.typ b/src/axes.typ index af28fba..8b1f3ef 100644 --- a/src/axes.typ +++ b/src/axes.typ @@ -204,12 +204,12 @@ draw.move-to(start) if axis.min > 0 { add-break(false) - draw.line((rel: size, to: start), end, mark: style.at("mark", default: none)) + draw.line((rel: size, to: start), end) } else if axis.max < 0 { draw.line(start, (rel: vector.scale(size, -1), to: end)) add-break(true) } - }, stroke: style.stroke) + }, stroke: style.stroke, mark: style.at("mark", default: none)) } else { draw.line(start, end, stroke: style.stroke, mark: style.at("mark", default: none)) } diff --git a/src/cetz.typ b/src/cetz.typ index 26e50fe..624a277 100644 --- a/src/cetz.typ +++ b/src/cetz.typ @@ -1,2 +1,2 @@ // Import cetz into the root scope. Import cetz by importing this file only! -#import "@preview/cetz:0.4.0": * +#import "@preview/cetz:0.4.2": * diff --git a/src/chart/barchart.typ b/src/chart/barchart.typ index 5a10ed4..79c9f3e 100644 --- a/src/chart/barchart.typ +++ b/src/chart/barchart.typ @@ -3,7 +3,7 @@ #import "/src/plot.typ" #let barchart-default-style = ( - axes: (tick: (length: 0), grid: (stroke: (dash: "dotted"))), + axes: (tick: (length: 0), grid: (stroke: (dash: "dotted", paint: gray))), bar-width: .8, cluster-gap: 0, error: ( diff --git a/src/chart/boxwhisker.typ b/src/chart/boxwhisker.typ index ec19539..ffb9e8a 100644 --- a/src/chart/boxwhisker.typ +++ b/src/chart/boxwhisker.typ @@ -3,7 +3,7 @@ #import "/src/plot.typ" #let boxwhisker-default-style = ( - axes: (tick: (length: 0), grid: (stroke: (dash: "dotted"))), + axes: (tick: (length: 0), grid: (stroke: (dash: "dotted", paint: gray))), box-width: 0.75, whisker-width: 0.5, mark-size: 0.15, diff --git a/src/chart/piechart.typ b/src/chart/piechart.typ index 23839c3..ba41a0a 100644 --- a/src/chart/piechart.typ +++ b/src/chart/piechart.typ @@ -225,7 +225,7 @@ group(name: name, ctx => { anchor("default", (0,0)) - let style = styles.resolve(ctx, + let style = styles.resolve(ctx.style, merge: style.named(), root: "piechart", base: default-style) let gap = style.gap diff --git a/src/chart/pyramid.typ b/src/chart/pyramid.typ index 838721b..8b008ad 100644 --- a/src/chart/pyramid.typ +++ b/src/chart/pyramid.typ @@ -138,7 +138,7 @@ draw.anchor("default", (0, 0)) let style = styles.resolve( - ctx, + ctx.style, merge: style.named(), root: "pyramid", base: default-style diff --git a/src/lib.typ b/src/lib.typ index 2f31dcc..f52981b 100644 --- a/src/lib.typ +++ b/src/lib.typ @@ -1,4 +1,4 @@ -#let version = version(0,1,2) +#let version = version(0,1,3) #import "/src/axes.typ" #import "/src/plot.typ" diff --git a/src/plot.typ b/src/plot.typ index 875299f..7f50209 100644 --- a/src/plot.typ +++ b/src/plot.typ @@ -202,7 +202,7 @@ legend-style: (:), ..options ) = draw.group(name: name, ctx => { - draw.assert-version(version(0, 4, 0)) + draw.assert-version(version(0, 4, 2)) // Create plot context object let make-ctx(x, y, size) = { diff --git a/tests/axes/self/ref/1.png b/tests/axes/self/ref/1.png index bc41ce0..09a285a 100644 Binary files a/tests/axes/self/ref/1.png and b/tests/axes/self/ref/1.png differ diff --git a/tests/chart/boxwhisker/ref/1.png b/tests/chart/boxwhisker/ref/1.png index adbbc92..4490aa0 100644 Binary files a/tests/chart/boxwhisker/ref/1.png and b/tests/chart/boxwhisker/ref/1.png differ diff --git a/tests/chart/piechart/test.typ b/tests/chart/piechart/test.typ index a736d16..8441094 100644 --- a/tests/chart/piechart/test.typ +++ b/tests/chart/piechart/test.typ @@ -9,68 +9,68 @@ // Outset items #test-case({ import draw: * - piechart(range(1,11), outset: 3, outset-offset: 25%, slice-style: colors) + piechart(range(1,11), outset: 3, outset-offset: 25%, slice-style: colors, stroke: none) }) // Outset items + inner radius #test-case({ import draw: * - piechart(range(1,11), outset: 3, inner-radius: .5, outset-offset: 25%, slice-style: colors) + piechart(range(1,11), outset: 3, inner-radius: .5, outset-offset: 25%, slice-style: colors, stroke: none) }) // Outset items + arc shape #test-case({ import draw: * piechart(range(1,5), outset-offset: 25%, slice-style: colors, - start: 0deg, stop: 180deg) + start: 0deg, stop: 180deg, stroke: none) }) // Outset items + inner radius #test-case({ import draw: * piechart(range(1,5), inner-radius: .5, outset-offset: 25%, slice-style: colors, - start: 45deg, stop: 135deg) + start: 45deg, stop: 135deg, stroke: none) }) // Rotated Values #test-case({ - piechart(range(1,11), slice-style: colors, outer-label: (angle: auto, content: "VALUE")) + piechart(range(1,11), slice-style: colors, outer-label: (angle: auto, content: "VALUE"), stroke: none) }) // Rotated Percentages #test-case({ - piechart(range(10, 60, step: 10), slice-style: colors, outer-label: (angle: auto, content: "%")) + piechart(range(10, 60, step: 10), slice-style: colors, outer-label: (angle: auto, content: "%"), stroke: none) }) // Inner Values #test-case({ - piechart(range(1,11), slice-style: colors, inner-label: (content: "VALUE"), radius: 2) + piechart(range(1,11), slice-style: colors, inner-label: (content: "VALUE"), radius: 2, stroke: none) }) // Inner Percentages #test-case({ - piechart(range(10, 60, step: 10), slice-style: colors, inner-label: (content: "%"), radius: 2) + piechart(range(10, 60, step: 10), slice-style: colors, inner-label: (content: "%"), radius: 2, stroke: none) }) // Gap as canvas size #test-case({ - piechart(range(1,11), gap: .1, slice-style: colors) + piechart(range(1,11), gap: .1, slice-style: colors, stroke: none) }) // Gap as canvas size + inner radius #test-case({ - piechart(range(1,11), gap: .1, inner-radius: .5, slice-style: colors) + piechart(range(1,11), gap: .1, inner-radius: .5, slice-style: colors, stroke: none) }) // Gap as angle #test-case({ - piechart(range(1,11), gap: 5deg, slice-style: colors, outer-label: (angle: auto)) + piechart(range(1,11), gap: 5deg, slice-style: colors, outer-label: (angle: auto), stroke: none) }) // Anchors #test-case({ import draw: * - piechart(range(1,11), slice-style: colors, name: "c", inner-radius: .5) + piechart(range(1,11), slice-style: colors, name: "c", inner-radius: .5, stroke: none) for-each-anchor("c", n => { circle("c." + n, radius: .05) }) @@ -79,7 +79,7 @@ // Keys #test-case({ piechart(((value: 1, label: [One], o: false), - (value: 1, label: [Two], o: true)), slice-style: colors, + (value: 1, label: [Two], o: true)), slice-style: colors, stroke: none, value-key: "value", label-key: "label", outer-label: (content: "LABEL", radius: 150%), outset-key: "o") }) @@ -93,6 +93,7 @@ (value: 1, label: [Six], o: 10%), (value: 1, label: [Seven], o: 12%), (value: 1, label: [Eight], o: 14%),), + stroke: none, slice-style: colors, value-key: "value", label-key: "label", outer-label: (content: "LABEL", radius: 150%), outset-key: "o") }) @@ -100,13 +101,13 @@ // Clockwise rotation #test-case({ import draw: * - piechart(range(1,4), clockwise: true, slice-style: (green, yellow, red)) + piechart(range(1,4), clockwise: true, slice-style: (green, yellow, red), stroke: none) }) // Counter clockwise rotation #test-case({ import draw: * - piechart(range(1,4), clockwise: false, slice-style: (green, yellow, red)) + piechart(range(1,4), clockwise: false, slice-style: (green, yellow, red), stroke: none) }) // 0 Elements diff --git a/tests/chart/self/ref/1.png b/tests/chart/self/ref/1.png index da5b59c..bf399c4 100644 Binary files a/tests/chart/self/ref/1.png and b/tests/chart/self/ref/1.png differ diff --git a/tests/plot/broken-axes/ref/1.png b/tests/plot/broken-axes/ref/1.png index 0eec936..9f0d888 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/self/ref/1.png b/tests/plot/self/ref/1.png index b3b88d3..b048c87 100644 Binary files a/tests/plot/self/ref/1.png and b/tests/plot/self/ref/1.png differ diff --git a/tests/plot/violin/ref/1.png b/tests/plot/violin/ref/1.png index da981b6..1f49fcb 100644 Binary files a/tests/plot/violin/ref/1.png and b/tests/plot/violin/ref/1.png differ diff --git a/typst.toml b/typst.toml index 95641fb..6058a2d 100644 --- a/typst.toml +++ b/typst.toml @@ -1,6 +1,6 @@ [package] name = "cetz-plot" -version = "0.1.2" +version = "0.1.3" compiler = "0.13.1" repository = "https://github.com/cetz-package/cetz-plot" entrypoint = "src/lib.typ"