Skip to content

Commit 7af0b29

Browse files
committed
implement option 3: light box components in front of the coord names
1 parent 876607c commit 7af0b29

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

xarray/core/formatting.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -425,8 +425,18 @@ def summarize_index(
425425
if max_width is None:
426426
max_width = OPTIONS["display_width"]
427427

428+
def prefix(index, length):
429+
if index == 0 and length == 1:
430+
return " "
431+
elif index == 0:
432+
return "┌"
433+
elif index >= length - 1:
434+
return "└"
435+
else:
436+
return "│"
437+
428438
preformatted = [
429-
pretty_print(f" {'-' if index == 0 else ' '} {name} ", col_width)
439+
pretty_print(f" {prefix(index, len(names))} {name} ", col_width)
430440
for index, name in enumerate(names)
431441
]
432442

0 commit comments

Comments
 (0)