From c1208a4174e9c7bd7da93c0a19fe62b2c571e472 Mon Sep 17 00:00:00 2001 From: Manas Date: Mon, 5 Jul 2021 21:56:03 +0530 Subject: [PATCH] updated implementations with new argument --- doc/source/pyplots/annotation.py | 2 +- doc/source/pyplots/introduction.py | 2 +- pyannote/core/annotation.py | 2 +- pyannote/core/notebook.py | 6 +++--- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/doc/source/pyplots/annotation.py b/doc/source/pyplots/annotation.py index b1f573d..5030281 100644 --- a/doc/source/pyplots/annotation.py +++ b/doc/source/pyplots/annotation.py @@ -11,6 +11,6 @@ annotation[Segment(6, 8)] = 'Bob' annotation[Segment(12, 18)] = 'Carol' annotation[Segment(7, 20)] = 'Alice' -notebook.plot_annotation(annotation, legend=True, time=True) +notebook.plot_annotation(annotation, legend=True, time=True, arrangement="pack") plt.show() diff --git a/doc/source/pyplots/introduction.py b/doc/source/pyplots/introduction.py index 54a6ecd..5e7032e 100644 --- a/doc/source/pyplots/introduction.py +++ b/doc/source/pyplots/introduction.py @@ -12,7 +12,7 @@ annotation[Segment(6, 8)] = 'Bob' annotation[Segment(12, 18)] = 'Carol' annotation[Segment(7, 20)] = 'Alice' -notebook.plot_annotation(annotation, legend=True, time=False) +notebook.plot_annotation(annotation, legend=True, time=False, arrangement="pack") # plot timeline plt.subplot(212) diff --git a/pyannote/core/annotation.py b/pyannote/core/annotation.py index 19e4311..9144ff3 100755 --- a/pyannote/core/annotation.py +++ b/pyannote/core/annotation.py @@ -1430,4 +1430,4 @@ def _repr_png_(self): return None from .notebook import repr_annotation - return repr_annotation(self) + return repr_annotation(self, arrangement="pack") diff --git a/pyannote/core/notebook.py b/pyannote/core/notebook.py index 63eae10..9a7530c 100644 --- a/pyannote/core/notebook.py +++ b/pyannote/core/notebook.py @@ -261,7 +261,7 @@ def __call__(self, resource: Resource, self.plot_timeline(resource, time=time) elif isinstance(resource, Annotation): - self.plot_annotation(resource, time=time, legend=legend) + self.plot_annotation(resource, time=time, legend=legend, arrangement="pack") elif isinstance(resource, SlidingWindowFeature): self.plot_feature(resource, time=time) @@ -391,13 +391,13 @@ def repr_timeline(timeline: Timeline): return data -def repr_annotation(annotation: Annotation): +def repr_annotation(annotation: Annotation, arrangement="pack"): """Get `png` data for `annotation`""" import matplotlib.pyplot as plt figsize = plt.rcParams['figure.figsize'] plt.rcParams['figure.figsize'] = (notebook.width, 2) fig, ax = plt.subplots() - notebook.plot_annotation(annotation, ax=ax) + notebook.plot_annotation(annotation, ax=ax, arrangement=arrangement) data = print_figure(fig, 'png') plt.close(fig) plt.rcParams['figure.figsize'] = figsize