Skip to content

Fix legends values on histogram kernc#195 #6

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jun 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
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
10 changes: 4 additions & 6 deletions backtesting/_plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -534,9 +534,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 @@ -550,9 +549,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