-
-
Notifications
You must be signed in to change notification settings - Fork 362
Closed
Labels
enhancementFeature requests and enhancementsFeature requests and enhancements
Description
Feature description
Current you cannot change the alignment of the bar labels in the barplot. I noticed this when plotting 90 degree rotated bar labels, they do not align in the center of the bar anymore.
I would either like to
- somehow automatically improve the bar label alignment for rotated labels
- make the bar label alignment a keyword argument option in the barplot
For plot types, please add an image of how it should look like
Here's how to get non-centered rotated bar labels. You'll notice the label text is shifted to the left of the center of the bar.
using CairoMakie, Makie
tbl = (x = [1, 1, 1, 2, 2, 2, 3, 3, 3],
height = 0.1:0.1:0.9,
grp = [1, 2, 3, 1, 2, 3, 1, 2, 3],
grp1 = [1, 2, 2, 1, 1, 2, 1, 1, 2],
grp2 = [1, 1, 2, 1, 2, 1, 1, 2, 1]
)
barplot(
tbl.x, tbl.height,
dodge = tbl.grp,
color = tbl.grp,
bar_labels = :y,
label_rotation = π/2,
label_offset = 15,
axis = (xticks = (1:3, ["left", "middle", "right"]),),
)(I also noticed that the ylimit is not ideal by default, the 0.9 label falls outside the axis, but that I can change manually)
I think we can fix this if we can change the label_aligns ourselves, which seems to be generated automatically right now.
barplot(
tbl.x, tbl.height,
dodge = tbl.grp,
color = tbl.grp,
bar_labels = :y,
label_rotation = π/2,
label_offset = 15,
axis = (xticks = (1:3, ["left", "middle", "right"]),),
label_aligns = (:left, :center), # this would probably fix the misalignment
)
Metadata
Metadata
Assignees
Labels
enhancementFeature requests and enhancementsFeature requests and enhancements