Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Fix add_vline with text annotation
  • Loading branch information
jjrob13 committed May 14, 2022
commit 07638aa22738616dfe34a7ca42e109b2944e8bac
4 changes: 4 additions & 0 deletions packages/python/plotly/plotly/shapeannotation.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
def _mean(x):
if len(x) == 0:
raise ValueError("x must have positive length")
# Mean of two of the same elements will just be that element.
# This fixes this https://github.com/plotly/plotly.py/issues/3065
if len(x) == 2 and x[0] == x[1]:
return x[0]
return float(sum(x)) / len(x)


Expand Down