Skip to content

Commit ad4fd6e

Browse files
authored
Merge pull request #6 from zlpatel/kernc#195
Fix legends values on histogram kernc#195
2 parents ea5d940 + 8a68757 commit ad4fd6e

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

backtesting/_plotting.py

+4-6
Original file line numberDiff line numberDiff line change
@@ -538,9 +538,8 @@ def __eq__(self, other):
538538
if is_overlay:
539539
ohlc_extreme_values[source_name] = arr
540540
if is_histogram:
541-
fig.vbar(x=source.data['index'], legend_label=legend_label,
542-
bottom=[0 for _ in source.data['index']],
543-
top=arr, width=BAR_WIDTH, color=color)
541+
fig.vbar('index', BAR_WIDTH, source_name, source=source,
542+
legend_label=legend_label, color=color)
544543
elif is_scatter:
545544
fig.scatter(
546545
'index', source_name, source=source,
@@ -554,9 +553,8 @@ def __eq__(self, other):
554553
line_width=1.3)
555554
else:
556555
if is_histogram:
557-
r = fig.vbar(x=source.data['index'], legend_label=LegendStr(legend_label),
558-
bottom=[0 for _ in source.data['index']],
559-
top=arr, width=BAR_WIDTH, color=color)
556+
r = fig.vbar('index', BAR_WIDTH, source_name, source=source,
557+
legend_label=LegendStr(legend_label), color=color)
560558
elif is_scatter:
561559
r = fig.scatter(
562560
'index', source_name, source=source,

backtesting/backtesting.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ def I(self, # noqa: E741, E743
106106
circle instead of a connected line segment (default).
107107
108108
If `histogram` is `True`, the indicator values will be plotted
109-
as a histogram instead of line or circle. When `histogram` is
109+
as a histogram instead of line or circle. When `histogram` is
110110
`True`, 'scatter' value will be ignored even if it's set.
111111
112112
Additional `*args` and `**kwargs` are passed to `func` and can

0 commit comments

Comments
 (0)