Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 85ea948

Browse filesBrowse files
committed
fix legend w/ 'expand' mode which fails for a single item.
1 parent 8a17df0 commit 85ea948
Copy full SHA for 85ea948

File tree

Expand file treeCollapse file tree

1 file changed

+4
-1
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+4
-1
lines changed

‎lib/matplotlib/offsetbox.py

Copy file name to clipboardExpand all lines: lib/matplotlib/offsetbox.py
+4-1Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,10 @@ def _get_packed_offsets(wd_list, total, sep, mode="fixed"):
7373
return total, offsets
7474

7575
elif mode == "expand":
76-
sep = (total - sum(w_list)) / (len(w_list) - 1.)
76+
if len(w_list) > 1:
77+
sep = (total - sum(w_list)) / (len(w_list) - 1.)
78+
else:
79+
sep = 0.
7780
offsets_ = np.add.accumulate([0] + [w + sep for w in w_list])
7881
offsets = offsets_[:-1]
7982

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.