Skip to content

Commit

Permalink
Merge pull request #1864 from leejjoon/fix-legend-expand
Browse files Browse the repository at this point in the history
fix legend w/ 'expand' mode which fails for a single item.
  • Loading branch information
dmcdougall committed Apr 1, 2013
2 parents b062b50 + eb3ecb2 commit bf81d2b
Show file tree
Hide file tree
Showing 5 changed files with 1,177 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/matplotlib/offsetbox.py
Expand Up @@ -73,7 +73,10 @@ def _get_packed_offsets(wd_list, total, sep, mode="fixed"):
return total, offsets

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

Expand Down
Binary file not shown.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit bf81d2b

Please sign in to comment.