Skip to content
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

Fix to draw scatter plots #849

Merged
merged 1 commit into from
Nov 10, 2023
Merged
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: 6 additions & 4 deletions src/evidently/ui/dashboards.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,24 +231,26 @@ def build_widget(self, reports: Iterable[ReportBase]) -> BaseWidgetInfo:
hovertemplate=hover,
)
else:
plot = self.plot_type_cls(
cls, args = self.plot_type_cls
plot = cls(
x=[p[0] for p in pts],
y=[p[1] for p in pts],
name=val.legend,
legendgroup=val.legend,
hovertemplate=hover,
**args,
)
fig.add_trace(plot)
return plotly_figure(title=self.title, figure=fig, size=self.size)

@property
def plot_type_cls(self):
if self.plot_type == PlotType.SCATTER:
return go.Scatter
return go.Scatter, {"mode": "markers"}
if self.plot_type == PlotType.BAR:
return go.Bar
return go.Bar, {}
if self.plot_type == PlotType.LINE:
return go.Line
return go.Line, {}
raise ValueError(f"Unsupported plot type {self.plot_type}")


Expand Down