Caution

You're reading the documentation for a development version. For the latest released version, please have a look at 0.11.0.

librosa.display.SvaraFormatter

class librosa.display.SvaraFormatter(Sa, octave=True, major=True, abbr=False, mela=None, unicode=True)[source]

Ticker formatter for Svara

Parameters:
Sanumber > 0

Frequency (in Hz) of Sa

octavebool

If True, display the octave number along with the note name.

Otherwise, only show the note name (and cent deviation)

majorbool

If True, ticks are always labeled.

If False, ticks are only labeled if the span is less than 2 octaves

abbrbool

If True, use abbreviated svara names.

If False, use full svara names.

melastr or int

For Carnatic svara, the index or name of the melakarta raga in question

To use Hindustani svara, set mela=None

unicodebool

If True, use unicode symbols for accidentals.

If False, use ASCII symbols for accidentals.

Examples

>>> import matplotlib.pyplot as plt
>>> values = librosa.midi_to_hz(np.arange(48, 72))
>>> fig, ax = plt.subplots(nrows=2)
>>> ax[0].bar(np.arange(len(values)), values)
>>> ax[0].set(ylabel='Hz')
>>> ax[1].bar(np.arange(len(values)), values)
>>> ax[1].yaxis.set_major_formatter(librosa.display.SvaraFormatter(261))
>>> ax[1].set(ylabel='Note')
../_images/librosa-display-SvaraFormatter-1.png
__init__(Sa, octave=True, major=True, abbr=False, mela=None, unicode=True)[source]

Methods

__init__(Sa[, octave, major, abbr, mela, ...])

create_dummy_axis(**kwargs)

fix_minus(s)

Some classes may want to replace a hyphen for minus with the proper Unicode symbol (U+2212) for typographical correctness. This is a helper method to perform such a replacement when it is enabled via :rc:`axes.unicode_minus`.

format_data(value)

Return the context-independent string representation of a single value.

format_data_short(value)

Return a short string representation of value for the mouseover tooltip (the coordinate display in the interactive figure window).

format_ticks(values)

Return the tick label strings for all values.

get_offset()

set_axis(axis)

set_locs(locs)

Set the locations of the ticks.

Attributes

axis

locs

[Deprecated]

major

vmin

vmax