Skip to content

Commit

Permalink
Fix Legend Label Measuring (#53)
Browse files Browse the repository at this point in the history
  • Loading branch information
johannes-wolf authored Oct 12, 2024
2 parents 7330b7e + 6c0adc3 commit 532970c
Show file tree
Hide file tree
Showing 7 changed files with 5 additions and 5 deletions.
Binary file modified gallery/barchart.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions src/plot/legend.typ
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
spacing: .1, // Spacing between anchor and legend
item: (
radius: 0,
spacing: .05, // Spacing between items
spacing: 0, // Extra spacing between items
preview: (
width: .75, // Preview width
height: .3, // Preview height
Expand Down Expand Up @@ -170,7 +170,7 @@

// Draw item preview
let draw-preview = if preview == auto { draw-generic-preview } else { preview }
group({
scope({
set-viewport(preview-a, preview-b, bounds: (1, 1, 0))
(draw-preview)(item)
})
Expand All @@ -186,7 +186,7 @@

// Draw label
content(label-west,
align(left + horizon, label),
text(top-edge: "ascender", bottom-edge: "descender", align(left + horizon, label)),
name: "label", anchor: "west")
}, name: "item", anchor: if style.orientation == ltr { "west" } else { "north-west" })

Expand Down
Binary file modified tests/axes/log-mode/ref/1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions tests/axes/log-mode/test.typ
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@
x => {calc.pow(10, x)},
samples: 100,
line: "raw",
label: $y=10^x$
label: $ y=10^x $,
)
plot.add(
domain: (1, 10),
x => {x},
samples: 100,
line: "raw",
hypograph: true,
label: $y=x$
label: $ y=x $,
)
}
)
Expand Down
Binary file modified tests/chart/piechart/ref/1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/plot/legend/ref/1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/plot/violin/ref/1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 532970c

Please sign in to comment.