pyannote / pyannote-metrics

A toolkit for reproducible evaluation, diagnostic, and error analysis of speaker diarization systems
http://pyannote.github.io/pyannote-metrics
MIT License
186 stars 33 forks source link

How to plot Annotation without Ipython Notebook #19

Closed jonlu0602 closed 6 years ago

jonlu0602 commented 6 years ago

Description

I tried to use matplotlib to plot some figures from pyannote-metrics, and I faced some problems

Steps/Code to Reproduce

This is the code I tried, but it didn't work.

import numpy import matplotlib.pyplot as plt from pyannote.core import Segment, Timeline, Annotation

plt.width = 10 plt.rcParams['figure.figsize'] = (plt.width, 3) plt.crop = Segment(0, 40) plt.subplot(211)

reference = Annotation() reference[Segment(0, 10)] = 'A' reference[Segment(12, 20)] = 'B' reference[Segment(24, 27)] = 'A' reference[Segment(30, 40)] = 'C' pdb.set_trace() # plt.plot cannot take the reference. plt.gca().text(0.6, 0.15, 'reference', fontsize=16) plt.show()

Expected Results

I hoped I can get the same figure in https://github.com/pyannote/pyannote-metrics/blob/master/notebooks/pyannote.metrics.diarization.ipynb

Versions

python 3.5