CairoMakie hlines behaviour

Hi everyone,

I’m trying to understand the output of the below MWE:

using CairoMakie
fig = Figure()
ax=Axis(fig[1, 1])

xmins = zeros(10)
xmaxs = [1:5; 3:7]
ys = 1:10

hlines!(ax, ys, xmin=xmins, xmax=xmaxs)

I was expecting horizontal lines that went from zero up to xmaxs stacked on top of each other. Instead I got the below figure:

I also can’t tell exactly from the documentation how the x-axis scaling works.
(I’m trying to create my own barcode plot and ultimately would like to have the different chunks of xmaxs colour coded but first thing’s first.)

Thank you for any suggestions.

Xmin and xmax are given in fraction of the axis, from 0 to 1, so yours all extend further than the axis but are clipped off so you can’t see that. The y axis is given in data scaling instead. That’s the point of the primitive, to plot a line across the axis that always covers the full width (or a fraction) no matter what the limits are. If you just want a line, use lines.

Thank you!