music21.graph.plot

Object definitions for plotting Stream objects.

The PlotStream object subclasses combine a Graph object with the PlotStreamMixin to give reusable approaches to graphing data and structures in Stream objects.

HistogramPitchSpace

class music21.graph.plot.HistogramPitchSpace(streamObj=None, **keywords)

A histogram of pitch space.

>>> s = corpus.parse('bach/bwv57.8')
>>> p = graph.plot.HistogramPitchSpace(s)
>>> p.id
'histogram-pitchSpace-count'
>>> p.run()  # with defaults and proper configuration, will open graph
../_images/HistogramPitchSpace.png

HistogramPitchSpace bases

HistogramPitchSpace read-only properties

Read-only properties inherited from PlotStreamMixin:

Read-only properties inherited from ProtoM21Object:

HistogramPitchSpace read/write properties

Read/write properties inherited from Graph:

HistogramPitchSpace methods

Methods inherited from Histogram:

Methods inherited from GraphHistogram:

Methods inherited from Graph:

Methods inherited from PlotStreamMixin:

Methods inherited from ProtoM21Object:

HistogramPitchSpace instance variables

Instance variables inherited from GraphHistogram:

HistogramPitchClass

class music21.graph.plot.HistogramPitchClass(streamObj=None, **keywords)

A histogram of pitch class

>>> s = corpus.parse('bach/bwv57.8')
>>> p = graph.plot.HistogramPitchClass(s)
>>> p.id
'histogram-pitchClass-count'
>>> p.run()  # with defaults and proper configuration, will open graph
../_images/HistogramPitchClass.png

HistogramPitchClass bases

HistogramPitchClass read-only properties

Read-only properties inherited from PlotStreamMixin:

Read-only properties inherited from ProtoM21Object:

HistogramPitchClass read/write properties

Read/write properties inherited from Graph:

HistogramPitchClass methods

Methods inherited from Histogram:

Methods inherited from GraphHistogram:

Methods inherited from Graph:

Methods inherited from PlotStreamMixin:

Methods inherited from ProtoM21Object:

HistogramPitchClass instance variables

Instance variables inherited from GraphHistogram:

HistogramQuarterLength

class music21.graph.plot.HistogramQuarterLength(streamObj=None, **keywords)

A histogram of pitch class.

>>> s = corpus.parse('bach/bwv57.8')
>>> p = graph.plot.HistogramQuarterLength(s)
>>> p.id
'histogram-quarterLength-count'
>>> p.run()  # with defaults and proper configuration, will open graph
../_images/HistogramQuarterLength.png

HistogramQuarterLength bases

HistogramQuarterLength read-only properties

Read-only properties inherited from PlotStreamMixin:

Read-only properties inherited from ProtoM21Object:

HistogramQuarterLength read/write properties

Read/write properties inherited from Graph:

HistogramQuarterLength methods

Methods inherited from Histogram:

Methods inherited from GraphHistogram:

Methods inherited from Graph:

Methods inherited from PlotStreamMixin:

Methods inherited from ProtoM21Object:

HistogramQuarterLength instance variables

Instance variables inherited from GraphHistogram:

WindowedKey

class music21.graph.plot.WindowedKey(streamObj=None, **keywords)

Stream plotting of windowed version of Krumhansl-Schmuckler analysis routine. See KrumhanslSchmuckler for more details.

>>> s = corpus.parse('bach/bwv66.6')
>>> p = graph.plot.WindowedKey(s.parts[0])
>>> p.run()  # with defaults and proper configuration, will open graph
../_images/WindowedKrumhanslSchmuckler.png ../_images/legend-WindowedKrumhanslSchmuckler.png

Set the processor class to one of the following for different uses:

>>> p = graph.plot.WindowedKey(s.parts.first())
>>> p.processorClass = analysis.discrete.AardenEssen
>>> p.processorClass = analysis.discrete.SimpleWeights
>>> p.processorClass = analysis.discrete.BellmanBudge
>>> p.processorClass = analysis.discrete.TemperleyKostkaPayne
>>> p.run()

WindowedKey bases

WindowedKey read-only properties

Read-only properties inherited from WindowedAnalysis:

Read-only properties inherited from PlotStreamMixin:

Read-only properties inherited from ProtoM21Object:

WindowedKey read/write properties

Read/write properties inherited from Graph:

WindowedKey methods

Methods inherited from WindowedAnalysis:

Methods inherited from GraphColorGrid:

Methods inherited from Graph:

Methods inherited from PlotStreamMixin:

Methods inherited from ProtoM21Object:

WindowedKey instance variables

Instance variables inherited from GraphColorGrid:

WindowedAmbitus

class music21.graph.plot.WindowedAmbitus(streamObj=None, **keywords)

Stream plotting of basic pitch span.

>>> s = corpus.parse('bach/bwv66.6')
>>> p = graph.plot.WindowedAmbitus(s.parts.first())
>>> p.run()  # with defaults and proper configuration, will open graph
../_images/WindowedAmbitus.png ../_images/legend-WindowedAmbitus.png

WindowedAmbitus bases

WindowedAmbitus read-only properties

Read-only properties inherited from WindowedAnalysis:

Read-only properties inherited from PlotStreamMixin:

Read-only properties inherited from ProtoM21Object:

WindowedAmbitus read/write properties

Read/write properties inherited from Graph:

WindowedAmbitus methods

Methods inherited from WindowedAnalysis:

Methods inherited from GraphColorGrid:

Methods inherited from Graph:

Methods inherited from PlotStreamMixin:

Methods inherited from ProtoM21Object:

WindowedAmbitus instance variables

Instance variables inherited from GraphColorGrid:

ScatterPitchSpaceQuarterLength

class music21.graph.plot.ScatterPitchSpaceQuarterLength(streamObj=None, **keywords)

A scatter plot of pitch space and quarter length

>>> s = corpus.parse('bach/bwv324.xml')
>>> p = graph.plot.ScatterPitchSpaceQuarterLength(s)
>>> p.id
'scatter-quarterLength-pitchSpace'
>>> p.run()
../_images/ScatterPitchSpaceQuarterLength.png

ScatterPitchSpaceQuarterLength bases

ScatterPitchSpaceQuarterLength read-only properties

Read-only properties inherited from PlotStreamMixin:

Read-only properties inherited from ProtoM21Object:

ScatterPitchSpaceQuarterLength read/write properties

Read/write properties inherited from Graph:

ScatterPitchSpaceQuarterLength methods

Methods inherited from GraphScatter:

Methods inherited from Graph:

Methods inherited from PlotStreamMixin:

Methods inherited from ProtoM21Object:

ScatterPitchClassQuarterLength

class music21.graph.plot.ScatterPitchClassQuarterLength(streamObj=None, **keywords)

A scatter plot of pitch class and quarter length

>>> s = corpus.parse('bach/bwv57.8')
>>> p = graph.plot.ScatterPitchClassQuarterLength(s)
>>> p.id
'scatter-quarterLength-pitchClass'
>>> p.run()
../_images/ScatterPitchClassQuarterLength.png

ScatterPitchClassQuarterLength bases

ScatterPitchClassQuarterLength read-only properties

Read-only properties inherited from PlotStreamMixin:

Read-only properties inherited from ProtoM21Object:

ScatterPitchClassQuarterLength read/write properties

Read/write properties inherited from Graph:

ScatterPitchClassQuarterLength methods

Methods inherited from GraphScatter:

Methods inherited from Graph:

Methods inherited from PlotStreamMixin:

Methods inherited from ProtoM21Object:

ScatterPitchClassOffset

class music21.graph.plot.ScatterPitchClassOffset(streamObj=None, **keywords)

A scatter plot of pitch class and offset

>>> s = corpus.parse('bach/bwv57.8')
>>> p = graph.plot.ScatterPitchClassOffset(s)
>>> p.id
'scatter-offset-pitchClass'
>>> p.run()
../_images/ScatterPitchClassOffset.png

ScatterPitchClassOffset bases

ScatterPitchClassOffset read-only properties

Read-only properties inherited from PlotStreamMixin:

Read-only properties inherited from ProtoM21Object:

ScatterPitchClassOffset read/write properties

Read/write properties inherited from Graph:

ScatterPitchClassOffset methods

Methods inherited from GraphScatter:

Methods inherited from Graph:

Methods inherited from PlotStreamMixin:

Methods inherited from ProtoM21Object:

ScatterPitchSpaceDynamicSymbol

class music21.graph.plot.ScatterPitchSpaceDynamicSymbol(streamObj=None, **keywords)

A graph of dynamics used by pitch space.

>>> s = corpus.parse('schumann_robert/opus41no1/movement2.xml')
>>> p = graph.plot.ScatterPitchSpaceDynamicSymbol(s)
>>> p.run()
../_images/ScatterPitchSpaceDynamicSymbol.png

ScatterPitchSpaceDynamicSymbol bases

ScatterPitchSpaceDynamicSymbol read-only properties

Read-only properties inherited from PlotStreamMixin:

Read-only properties inherited from ProtoM21Object:

ScatterPitchSpaceDynamicSymbol read/write properties

Read/write properties inherited from Graph:

ScatterPitchSpaceDynamicSymbol methods

ScatterPitchSpaceDynamicSymbol.extractData()

Methods inherited from GraphScatter:

Methods inherited from Graph:

Methods inherited from PlotStreamMixin:

Methods inherited from ProtoM21Object:

HorizontalBarPitchSpaceOffset

class music21.graph.plot.HorizontalBarPitchSpaceOffset(streamObj=None, *, colorByPart=False, **keywords)

A graph of events, sorted by pitch space, over time, generally called a “piano roll”.

>>> s = corpus.parse('bach/bwv57.8')
>>> p = graph.plot.HorizontalBarPitchSpaceOffset(s)
>>> p.run()  # with defaults and proper configuration, will open graph
../_images/HorizontalBarPitchSpaceOffset.png

HorizontalBarPitchSpaceOffset bases

HorizontalBarPitchSpaceOffset read-only properties

Read-only properties inherited from GraphHorizontalBar:

Read-only properties inherited from PlotStreamMixin:

Read-only properties inherited from ProtoM21Object:

HorizontalBarPitchSpaceOffset read/write properties

Read/write properties inherited from Graph:

HorizontalBarPitchSpaceOffset methods

Methods inherited from HorizontalBar:

Methods inherited from GraphHorizontalBar:

Methods inherited from Graph:

Methods inherited from PlotStreamMixin:

Methods inherited from ProtoM21Object:

HorizontalBarPitchSpaceOffset instance variables

Instance variables inherited from GraphHorizontalBar:

HorizontalBarPitchClassOffset

class music21.graph.plot.HorizontalBarPitchClassOffset(streamObj=None, *, colorByPart=False, **keywords)

A graph of events, sorted by pitch class, over time.

>>> s = corpus.parse('bach/bwv57.8')
>>> p = graph.plot.HorizontalBarPitchClassOffset(s)
>>> p.run()  # with defaults and proper configuration, will open graph
../_images/HorizontalBarPitchClassOffset.png

HorizontalBarPitchClassOffset bases

HorizontalBarPitchClassOffset read-only properties

Read-only properties inherited from GraphHorizontalBar:

Read-only properties inherited from PlotStreamMixin:

Read-only properties inherited from ProtoM21Object:

HorizontalBarPitchClassOffset read/write properties

Read/write properties inherited from Graph:

HorizontalBarPitchClassOffset methods

Methods inherited from HorizontalBar:

Methods inherited from GraphHorizontalBar:

Methods inherited from Graph:

Methods inherited from PlotStreamMixin:

Methods inherited from ProtoM21Object:

HorizontalBarPitchClassOffset instance variables

Instance variables inherited from GraphHorizontalBar:

Dolan

class music21.graph.plot.Dolan(streamObj=None, **keywords)

A graph of the activity of a parameter of a part (or a group of parts) over time. The default parameter graphed is Dynamics. Dynamics are assumed to extend activity to the next change in dynamics.

Numerous parameters can be configured based on functionality encoded in the PartReduction object.

If the fillByMeasure parameter is True, and if measures are available, each part will segment by Measure divisions, and look for the target activity only once per Measure. If more than one target is found in the Measure, values will be averaged. If fillByMeasure is False, the part will be segmented by each Note.

The segmentByTarget parameter is True, segments, which may be Notes or Measures, will be divided if necessary to show changes that occur over the duration of the segment by a target object.

If the normalizeByPart parameter is True, each part will be normalized within the range only of that part. If False, all parts will be normalized by the max of all parts. The default is True.

>>> s = corpus.parse('bwv66.6')
>>> dyn = ['p', 'mf', 'f', 'ff', 'mp', 'fff', 'ppp']
>>> i = 0
>>> for p in s.parts:
...     for m in p.getElementsByClass(stream.Measure):
...         m.insert(0, dynamics.Dynamic(dyn[i % len(dyn)]))
...         i += 1
...
>>> s.plot('dolan', fillByMeasure=True, segmentByTarget=True)
../_images/Dolan.png

Dolan bases

Dolan read-only properties

Read-only properties inherited from GraphHorizontalBarWeighted:

Read-only properties inherited from PlotStreamMixin:

Read-only properties inherited from ProtoM21Object:

Dolan read/write properties

Read/write properties inherited from Graph:

Dolan methods

Methods inherited from HorizontalBarWeighted:

Methods inherited from GraphHorizontalBarWeighted:

Methods inherited from Graph:

Methods inherited from PlotStreamMixin:

Methods inherited from ProtoM21Object:

Dolan instance variables

Instance variables inherited from GraphHorizontalBarWeighted:

ScatterWeightedPitchSpaceQuarterLength

class music21.graph.plot.ScatterWeightedPitchSpaceQuarterLength(streamObj=None, **keywords)

A graph of event, sorted by pitch, over time.

>>> s = corpus.parse('bach/bwv57.8')
>>> p = graph.plot.ScatterWeightedPitchSpaceQuarterLength(s)
>>> p.run()  # with defaults and proper configuration, will open graph
../_images/ScatterWeightedPitchSpaceQuarterLength.png

ScatterWeightedPitchSpaceQuarterLength bases

ScatterWeightedPitchSpaceQuarterLength read-only properties

Read-only properties inherited from GraphScatterWeighted:

Read-only properties inherited from PlotStreamMixin:

Read-only properties inherited from ProtoM21Object:

ScatterWeightedPitchSpaceQuarterLength read/write properties

Read/write properties inherited from Graph:

ScatterWeightedPitchSpaceQuarterLength methods

Methods inherited from GraphScatterWeighted:

Methods inherited from Graph:

Methods inherited from PlotStreamMixin:

Methods inherited from ProtoM21Object:

ScatterWeightedPitchSpaceQuarterLength instance variables

Instance variables inherited from GraphScatterWeighted:

ScatterWeightedPitchClassQuarterLength

class music21.graph.plot.ScatterWeightedPitchClassQuarterLength(streamObj=None, **keywords)

A graph of event, sorted by pitch class, over time.

>>> s = corpus.parse('bach/bwv57.8')
>>> p = graph.plot.ScatterWeightedPitchClassQuarterLength(s)
>>> p.run()  # with defaults and proper configuration, will open graph
../_images/ScatterWeightedPitchClassQuarterLength.png

ScatterWeightedPitchClassQuarterLength bases

ScatterWeightedPitchClassQuarterLength read-only properties

Read-only properties inherited from GraphScatterWeighted:

Read-only properties inherited from PlotStreamMixin:

Read-only properties inherited from ProtoM21Object:

ScatterWeightedPitchClassQuarterLength read/write properties

Read/write properties inherited from Graph:

ScatterWeightedPitchClassQuarterLength methods

Methods inherited from GraphScatterWeighted:

Methods inherited from Graph:

Methods inherited from PlotStreamMixin:

Methods inherited from ProtoM21Object:

ScatterWeightedPitchClassQuarterLength instance variables

Instance variables inherited from GraphScatterWeighted:

ScatterWeightedPitchSpaceDynamicSymbol

class music21.graph.plot.ScatterWeightedPitchSpaceDynamicSymbol(streamObj=None, **keywords)

A graph of dynamics used by pitch space.

>>> s = corpus.parse('schumann_robert/opus41no1/movement2.xml')
>>> p = graph.plot.ScatterWeightedPitchSpaceDynamicSymbol(s)
>>> p.run()  # with defaults and proper configuration, will open graph
../_images/ScatterWeightedPitchSpaceDynamicSymbol.png

ScatterWeightedPitchSpaceDynamicSymbol bases

ScatterWeightedPitchSpaceDynamicSymbol read-only properties

Read-only properties inherited from GraphScatterWeighted:

Read-only properties inherited from PlotStreamMixin:

Read-only properties inherited from ProtoM21Object:

ScatterWeightedPitchSpaceDynamicSymbol read/write properties

Read/write properties inherited from Graph:

ScatterWeightedPitchSpaceDynamicSymbol methods

ScatterWeightedPitchSpaceDynamicSymbol.extractData()

Methods inherited from GraphScatterWeighted:

Methods inherited from Graph:

Methods inherited from PlotStreamMixin:

Methods inherited from ProtoM21Object:

ScatterWeightedPitchSpaceDynamicSymbol instance variables

Instance variables inherited from GraphScatterWeighted:

Plot3DBarsPitchSpaceQuarterLength

class music21.graph.plot.Plot3DBarsPitchSpaceQuarterLength(streamObj=None, **keywords)

A scatter plot of pitch and quarter length

>>> from music21.musicxml import testFiles
>>> s = converter.parse(testFiles.mozartTrioK581Excerpt)
>>> p = graph.plot.Plot3DBarsPitchSpaceQuarterLength(s)
>>> p.id
'3DBars-quarterLength-pitchSpace-count'
>>> p.run()  # with defaults and proper configuration, will open graph
../_images/Plot3DBarsPitchSpaceQuarterLength.png

Plot3DBarsPitchSpaceQuarterLength bases

Plot3DBarsPitchSpaceQuarterLength read-only properties

Read-only properties inherited from PlotStreamMixin:

Read-only properties inherited from ProtoM21Object:

Plot3DBarsPitchSpaceQuarterLength read/write properties

Read/write properties inherited from Graph:

Plot3DBarsPitchSpaceQuarterLength methods

Methods inherited from Graph3DBars:

Methods inherited from Graph:

Methods inherited from PlotStreamMixin:

Methods inherited from ProtoM21Object:

Features

class music21.graph.plot.Features(streamList, featureExtractors, labelList=None, **keywords)

Plots the output of a set of feature extractors.

FeatureExtractors can be ids or classes.

Features bases

Features read-only properties

Read-only properties inherited from PlotStreamMixin:

Read-only properties inherited from ProtoM21Object:

Features read/write properties

Read/write properties inherited from Graph:

Features methods

Features.extractData()
Features.run(*, callProcess: bool = True, **keywords)

main routine to extract data, set axis labels, run process() on the underlying Graph object, and if self.doneAction is not None, either write or show the graph.

Methods inherited from MultiStream:

Methods inherited from GraphGroupedVerticalBar:

Methods inherited from Graph:

Methods inherited from PlotStreamMixin:

Methods inherited from ProtoM21Object:

Histogram

class music21.graph.plot.Histogram(streamObj=None, **keywords)

Base class for histograms that plot one axis against its count

Histogram bases

Histogram read-only properties

Read-only properties inherited from PlotStreamMixin:

Read-only properties inherited from ProtoM21Object:

Histogram read/write properties

Read/write properties inherited from Graph:

Histogram methods

Histogram.remapXTicksData()

Changes the ticks and data so that they both run 1, 2, 3, 4, etc.

Histogram.run(*, callProcess: bool = True, **keywords)

Override run method to remap X data into individual bins.

Methods inherited from GraphHistogram:

Methods inherited from Graph:

Methods inherited from PlotStreamMixin:

Methods inherited from ProtoM21Object:

Histogram instance variables

Instance variables inherited from GraphHistogram:

HorizontalBar

class music21.graph.plot.HorizontalBar(streamObj: Stream | None = None, *, colorByPart=False, **keywords)

A graph of events, sorted by pitch, over time.

If colorByPart is True, then each part will get its own color from self.colors (unless there are more parts than colors).

HorizontalBar bases

HorizontalBar read-only properties

Read-only properties inherited from GraphHorizontalBar:

Read-only properties inherited from PlotStreamMixin:

Read-only properties inherited from ProtoM21Object:

HorizontalBar read/write properties

Read/write properties inherited from Graph:

HorizontalBar methods

HorizontalBar.assignColorsToParts() dict[music21.stream.base.Part, str]

Give a different color for each part, if self.colorByPart is True.

Returns the assignment for any further manipulation.

Currently, two piano hands (PartStaff objects) get different colors.

>>> bach = corpus.parse('bwv66.6')
>>> plot = graph.plot.HorizontalBar(bach, colorByPart=True)
>>> plot.assignColorsToParts()
{<music21.stream.Part Soprano>: '#605c7f',
 <music21.stream.Part Alto>: '#5c7f60',
 <music21.stream.Part Tenor>: '#988969',
 <music21.stream.Part Bass>: '#628297'}
HorizontalBar.postProcessData()

Call any post data processing routines here and on any axes.

HorizontalBar.postProcessElement(el: Music21Object, formatDict: dict[Any, Any], *values: list[numbers.Real])

Assign colors to each element if colorByPart is True.

HorizontalBar.run(*, callProcess: bool = True, **keywords)

Optionally assign colors to Part objects and then do the normal run.

Methods inherited from GraphHorizontalBar:

Methods inherited from Graph:

Methods inherited from PlotStreamMixin:

Methods inherited from ProtoM21Object:

HorizontalBar instance variables

Instance variables inherited from GraphHorizontalBar:

HorizontalBarWeighted

class music21.graph.plot.HorizontalBarWeighted(streamObj=None, **keywords)

A base class for plots of Scores with weighted (by height) horizontal bars. Many weighted segments represent a dynamic parameter of a Part.

HorizontalBarWeighted bases

HorizontalBarWeighted read-only properties

Read-only properties inherited from GraphHorizontalBarWeighted:

Read-only properties inherited from PlotStreamMixin:

Read-only properties inherited from ProtoM21Object:

HorizontalBarWeighted read/write properties

Read/write properties inherited from Graph:

HorizontalBarWeighted methods

HorizontalBarWeighted.extractData()

Extract the data from the Stream.

Methods inherited from GraphHorizontalBarWeighted:

Methods inherited from Graph:

Methods inherited from PlotStreamMixin:

Methods inherited from ProtoM21Object:

HorizontalBarWeighted instance variables

Instance variables inherited from GraphHorizontalBarWeighted:

MultiStream

class music21.graph.plot.MultiStream(streamList, labelList=None, **keywords)

Approaches to plotting and graphing multiple Streams. A base class from which Stream plotting Classes inherit.

Not yet integrated into the new 2017 system, unfortunately…

Provide a list of Streams as an argument. Optionally provide an additional list of labels for each list.

MultiStream bases

MultiStream read-only properties

Read-only properties inherited from PlotStreamMixin:

Read-only properties inherited from ProtoM21Object:

MultiStream read/write properties

Read/write properties inherited from Graph:

MultiStream methods

MultiStream.parseStreams(streamList)

Methods inherited from GraphGroupedVerticalBar:

Methods inherited from Graph:

Methods inherited from PlotStreamMixin:

Methods inherited from ProtoM21Object:

Plot3DBars

class music21.graph.plot.Plot3DBars(streamObj=None, **keywords)

Base class for Stream plotting classes.

Plot3DBars bases

Plot3DBars read-only properties

Read-only properties inherited from PlotStreamMixin:

Read-only properties inherited from ProtoM21Object:

Plot3DBars read/write properties

Read/write properties inherited from Graph:

Plot3DBars methods

Methods inherited from Graph3DBars:

Methods inherited from Graph:

Methods inherited from PlotStreamMixin:

Methods inherited from ProtoM21Object:

PlotStream

class music21.graph.plot.PlotStream(streamObj=None, **keywords)

A generic stream plotter.

PlotStream bases

PlotStream read-only properties

Read-only properties inherited from PlotStreamMixin:

Read-only properties inherited from ProtoM21Object:

PlotStream read/write properties

Read/write properties inherited from Graph:

PlotStream methods

Methods inherited from Graph:

Methods inherited from PlotStreamMixin:

Methods inherited from ProtoM21Object:

PlotStreamMixin

class music21.graph.plot.PlotStreamMixin(streamObj=None, recurse=True, **keywords)

This Mixin adds Stream extracting and Axis holding features to any class derived from Graph.

PlotStreamMixin bases

PlotStreamMixin read-only properties

PlotStreamMixin.allAxes

return a list of axisX, axisY, axisZ if any are defined in the class.

Some might be None.

>>> s = stream.Stream()
>>> p = graph.plot.ScatterPitchClassOffset(s)
>>> p.allAxes
[<music21.graph.axis.OffsetAxis: x axis for ScatterPitchClassOffset>,
 <music21.graph.axis.PitchClassAxis: y axis for ScatterPitchClassOffset>]
PlotStreamMixin.id

Each PlotStream has a unique id that consists of its class name and the class names of the axes:

>>> s = stream.Stream()
>>> pScatter = graph.plot.ScatterPitchClassQuarterLength(s)
>>> pScatter.id
'scatter-quarterLength-pitchClass'

Read-only properties inherited from ProtoM21Object:

PlotStreamMixin methods

PlotStreamMixin.extractChordDataMultiAxis(c, formatDict)

Returns a list of lists of values for each axis.

static PlotStreamMixin.extractChordDataOneAxis(ax, c, formatDict)

Look for Note-like attributes in a Chord. This is done by first looking at the Chord, and then, if attributes are not found, looking at each pitch.

Returns a list of values.

PlotStreamMixin.extractData()
static PlotStreamMixin.fillValueLists(elementValues, nullFillValue=0)

pads a list of lists so that each list has the same length. Pads with the first element of the list or nullFillValue if the list has no elements. Modifies in place so returns None

Used by extractChordDataMultiAxis

>>> l0 = [2, 3, 4]
>>> l1 = [10, 20, 30, 40, 50]
>>> l2 = []
>>> listOfLists = [l0, l1, l2]
>>> graph.plot.PlotStream.fillValueLists(listOfLists)
>>> listOfLists
[[2,   3,  4,  2,  2],
 [10, 20, 30, 40, 50],
 [0,   0,  0,  0,  0]]
PlotStreamMixin.postProcessData()

Call any post data processing routines here and on any axes.

PlotStreamMixin.postProcessElement(el: Music21Object, formatDict: dict[Any, Any], *values: list[numbers.Real]) None

Any processing that needs to take place for each element, independent of what the axis is finding can go here. For chords, a single formatDict applies to all pitches/notes in the chord.

PlotStreamMixin.processOneElement(el: Music21Object)

Get a list of data from a single element (generally a Note or chord):

>>> n = note.Note('C#4')
>>> n.offset = 10.25
>>> s = stream.Stream([n])
>>> pl = graph.plot.ScatterPitchClassOffset(s)
>>> pl.processOneElement(n)
[(10.25, 1, {})]
>>> c = chord.Chord(['D4', 'E5'])
>>> s.insert(5.0, c)
>>> pl.processOneElement(c)
[(5.0, 2, {}), (5.0, 4, {})]
PlotStreamMixin.run(*, callProcess: bool = True, **keywords)

main routine to extract data, set axis labels, run process() on the underlying Graph object, and if self.doneAction is not None, either write or show the graph.

PlotStreamMixin.setAxisKeywords()

Configure axis parameters based on keywords given when creating the Plot.

Looks in self.savedKeywords, in case any post creation manipulation needs to happen.

Finds keywords that begin with x, y, z and sets the remainder of the keyword (lowercasing the first letter) as an attribute. Does not set any new attributes, only existing ones.

>>> b = corpus.parse('bwv66.6')
>>> hist = graph.plot.HistogramPitchSpace(b, xHideUnused=False)
>>> hist.axisX.hideUnused
True
>>> hist.setAxisKeywords()
>>> hist.axisX.hideUnused
False

Methods inherited from ProtoM21Object:

Scatter

class music21.graph.plot.Scatter(streamObj=None, **keywords)

Base class for 2D scatter plots.

Scatter bases

Scatter read-only properties

Read-only properties inherited from PlotStreamMixin:

Read-only properties inherited from ProtoM21Object:

Scatter read/write properties

Read/write properties inherited from Graph:

Scatter methods

Methods inherited from GraphScatter:

Methods inherited from Graph:

Methods inherited from PlotStreamMixin:

Methods inherited from ProtoM21Object:

ScatterWeighted

class music21.graph.plot.ScatterWeighted(streamObj=None, **keywords)

Base class for histograms that plot one axis against its count.

The count is stored as the Z axis, though it is represented as size.

ScatterWeighted bases

ScatterWeighted read-only properties

Read-only properties inherited from GraphScatterWeighted:

Read-only properties inherited from PlotStreamMixin:

Read-only properties inherited from ProtoM21Object:

ScatterWeighted read/write properties

Read/write properties inherited from Graph:

ScatterWeighted methods

Methods inherited from GraphScatterWeighted:

Methods inherited from Graph:

Methods inherited from PlotStreamMixin:

Methods inherited from ProtoM21Object:

ScatterWeighted instance variables

Instance variables inherited from GraphScatterWeighted:

WindowedAnalysis

class music21.graph.plot.WindowedAnalysis(streamObj=None, **keywords)

Base Plot for windowed analysis routines such as Key Analysis or Ambitus.

WindowedAnalysis bases

WindowedAnalysis read-only properties

WindowedAnalysis.processor

Read-only properties inherited from PlotStreamMixin:

Read-only properties inherited from ProtoM21Object:

WindowedAnalysis read/write properties

Read/write properties inherited from Graph:

WindowedAnalysis methods

WindowedAnalysis.extractData()

Extract data actually calls the processing routine.

Returns two element tuple of the data (colorMatrix) and the yTicks list

WindowedAnalysis.run(*, callProcess: bool = True, **keywords)

actually create the graph…

WindowedAnalysis.write(fp=None)

Overrides the normal write method here to add a legend.

Methods inherited from GraphColorGrid:

Methods inherited from Graph:

Methods inherited from PlotStreamMixin:

Methods inherited from ProtoM21Object:

WindowedAnalysis instance variables

Instance variables inherited from GraphColorGrid: