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 bf81d2b

Browse filesBrowse files
committed
Merge pull request #1864 from leejjoon/fix-legend-expand
fix legend w/ 'expand' mode which fails for a single item.
2 parents b062b50 + eb3ecb2 commit bf81d2b
Copy full SHA for bf81d2b

File tree

Expand file treeCollapse file tree

5 files changed

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

5 files changed

+1177
-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

Binary file not shown.
Loading

0 commit comments

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