Skip to content

Commit

Permalink
[#53212] core: drawing: Added case for drawing violin plots on consta…
Browse files Browse the repository at this point in the history
…nt measurements

Signed-off-by: Krzysztof Wasielewski <kwasielewski@internships.antmicro.com>
  • Loading branch information
kwasielewski committed Jan 22, 2024
1 parent 663982a commit 508496f
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions kenning/core/drawing.py
Original file line number Diff line number Diff line change
Expand Up @@ -476,12 +476,15 @@ def plot_bokeh(self, output_path: Path, output_formats: Iterable[str]):
zip(self.colors, self.metric_data.items())
):
for name, sample in zip(self.metric_labels, samples):
kde = gaussian_kde(sample)
x_min = min(sample)
x_max = max(sample)
x = np.linspace(x_min, x_max, 1000)
y = kde.pdf(x)
y *= 0.45 / max(y)
if x_min == x_max:
y = np.full(x.shape, 0.45)
else:
kde = gaussian_kde(sample)
y = kde.pdf(x)
y *= 0.45 / max(y)
renderer = violin_figs[name].add_glyph(
ColumnDataSource(
data=dict(
Expand Down

0 comments on commit 508496f

Please sign in to comment.