You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, padding for objects (eg Label) is specified as four numbers, padding=(a, b, c, d).
I personally find it very hard to remember the order, and basically never get it right on the first try. Probably the issue lies in the apparent similarity with CSS (it also uses four numbers), but a completely different order: (l, r, b, t) in Makie and (t, r, b, l) in CSS.
Can we use a more intuitive interface? Some potential examples:
Two intervals instead of four numbers: padding=(0 ± 5, 0 ± 2) for 5px horizontal and 2px vertical, or (-3..5, -2..1) for different offsets in all four directions. This is already easier to understand, the l/r and t/b order is clear, only hor-vert remains, but it is more natural (x always comes before y).
An explicit rectangle, like padding=Rect(0 ± 5, 0 ± 2). Slightly more verbose, but even more understandable and can neatly generalize to other shapes. Currently used in MakieExtra.textwithbox to try out this specification in practice.
I think either of these would be an improvement. Maybe even both should be supported, with a tuple-of-intervals being converted to a rect under the hood. Rects would play especially nicely if GeometryBasics could define a dilate(shape_a, shape_b) morphological operation.
Or maybe something different would be even better here?..
The text was updated successfully, but these errors were encountered:
Currently, padding for objects (eg
Label
) is specified as four numbers,padding=(a, b, c, d)
.I personally find it very hard to remember the order, and basically never get it right on the first try. Probably the issue lies in the apparent similarity with CSS (it also uses four numbers), but a completely different order:
(l, r, b, t)
in Makie and(t, r, b, l)
in CSS.Can we use a more intuitive interface? Some potential examples:
padding=(0 ± 5, 0 ± 2)
for 5px horizontal and 2px vertical, or(-3..5, -2..1)
for different offsets in all four directions. This is already easier to understand, the l/r and t/b order is clear, only hor-vert remains, but it is more natural (x
always comes beforey
).padding=Rect(0 ± 5, 0 ± 2)
. Slightly more verbose, but even more understandable and can neatly generalize to other shapes. Currently used inMakieExtra.textwithbox
to try out this specification in practice.I think either of these would be an improvement. Maybe even both should be supported, with a tuple-of-intervals being converted to a rect under the hood. Rects would play especially nicely if
GeometryBasics
could define adilate(shape_a, shape_b)
morphological operation.Or maybe something different would be even better here?..
The text was updated successfully, but these errors were encountered: