Skip to content

Commit

Permalink
Merge pull request #6 from zlpatel/kernc#195
Browse files Browse the repository at this point in the history
 Fix legends values on histogram kernc#195
  • Loading branch information
zlpatel authored Jun 15, 2021
2 parents ea5d940 + 8a68757 commit ad4fd6e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
10 changes: 4 additions & 6 deletions backtesting/_plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -538,9 +538,8 @@ def __eq__(self, other):
if is_overlay:
ohlc_extreme_values[source_name] = arr
if is_histogram:
fig.vbar(x=source.data['index'], legend_label=legend_label,
bottom=[0 for _ in source.data['index']],
top=arr, width=BAR_WIDTH, color=color)
fig.vbar('index', BAR_WIDTH, source_name, source=source,
legend_label=legend_label, color=color)
elif is_scatter:
fig.scatter(
'index', source_name, source=source,
Expand All @@ -554,9 +553,8 @@ def __eq__(self, other):
line_width=1.3)
else:
if is_histogram:
r = fig.vbar(x=source.data['index'], legend_label=LegendStr(legend_label),
bottom=[0 for _ in source.data['index']],
top=arr, width=BAR_WIDTH, color=color)
r = fig.vbar('index', BAR_WIDTH, source_name, source=source,
legend_label=LegendStr(legend_label), color=color)
elif is_scatter:
r = fig.scatter(
'index', source_name, source=source,
Expand Down
2 changes: 1 addition & 1 deletion backtesting/backtesting.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def I(self, # noqa: E741, E743
circle instead of a connected line segment (default).
If `histogram` is `True`, the indicator values will be plotted
as a histogram instead of line or circle. When `histogram` is
as a histogram instead of line or circle. When `histogram` is
`True`, 'scatter' value will be ignored even if it's set.
Additional `*args` and `**kwargs` are passed to `func` and can
Expand Down

0 comments on commit ad4fd6e

Please sign in to comment.