§
    ƒØj
 ã                  ój  — d Z ddlmZ ddlZddlZddlZddlZddlZej	        rddl
ZddlZddlmZ ddlmZ ddlmZ ddlmZmZmZmZ ddlmZ  ej        d	¦  «        Z G d
„ dej        ¦  «        Z G d„ de¦  «        Z G d„ de¦  «        Z G d„ de¦  «        Z G d„ de¦  «        Z G d„ de¦  «        Z  G d„ de¦  «        Z! G d„ de¦  «        Z" G d„ de¦  «        Z# G d„ de¦  «        Z$ G d„ dej%        ¦  «        Z& G d „ d!ej%        ¦  «        Z'e(d"k    rddlZ ej)        e&¦  «         dS dS )#a  
Object definitions for graphing and plotting :class:`~music21.stream.Stream` objects.

The :class:`~music21.graph.primitives.Graph` object subclasses primitive,
abstract fundamental graphing archetypes using the matplotlib library.

From the highest level to the lowest level of usage, ways of graphing are as follows:

    1. streamObj.plot('graphName')
    2. graph.plot.Class(streamObj).run()
    3. plotter = graph.primitives.Class(); plotter.data = ...; plotter.process()
    4. Use matplotlib directly to create your graph.
é    )ÚannotationsN)Úcommon)ÚSubConverter)Úenvironment)ÚgetExtendedModulesÚGraphExceptionÚgetColorÚaccidentalLabelToUnicode)Úprebasezgraph.primitivesc                  ó0  — e Zd ZU dZdZdZded<   dZded<   d	Zded
<   dAd„Z	dAd„Z
dBd„ZdCd„ZedDd„¦   «         Zej        dEd„¦   «         ZdFd„ZdGd„Z	 	 dHdId#„Z	 dJdKd)„ZdLdMd.„ZedLdNd2„¦   «         ZdOd3„ZdOd4„ZdPd7„ZdAd8„ZdOd9„ZdQdRd<„ZdAd=„Z	 dQdSd@„Zd:S )TÚGrapha�  
    A music21.graph.primitives.Graph is an object that represents a visual graph or
    plot, automating the creation and configuration of this graph in matplotlib.
    It is a low-level object that most music21 users do not need to call directly;
    yet, as most graphs will take keyword arguments that specify the
    look of graphs, they are important to know about.

    The keyword arguments can be provided for configuration are:

    *    doneAction (see below)
    *    alpha (which describes how transparent elements of the graph are)
    *    dpi
    *    colorBackgroundData
    *    colorBackgroundFigure
    *    colorGrid,
    *    title (a string)
    *    figureSize (a tuple of two ints)
    *    colors (a list of colors to cycle through)
    *    tickFontSize
    *    tickColors (a dict of 'x': '#color', 'y': '#color')
    *    titleFontSize
    *    labelFontSize
    *    fontFamily
    *    hideXGrid
    *    hideYGrid
    *    xTickLabelRotation
    *    marker
    *    markersize

    Graph objects do not manipulate Streams or other music21 data; they only
    manipulate raw data formatted for each Graph subclass, hence it is
    unlikely that users will call this class directly.

    The `doneAction` argument determines what happens after the graph
    has been processed. Currently, there are three options, 'write' creates
    a file on disk (this is the default), while 'show' opens an
    interactive GUI browser.  The
    third option, None, does the processing but does not write any output.

    figureSize:

        A two-element iterable.

        Scales all graph components but because of matplotlib limitations
        (esp. on 3d graphs) no all labels scale properly.

        defaults to .figureSizeDefault

    >>> a = graph.primitives.Graph(title='a graph of some data to be given soon', tickFontSize=9)
    >>> a.data = [[0, 2], [1, 3]]
    >>> a.graphType
    'genericGraph'
    ÚgenericGraph©ÚxÚyútuple[str, ...]ÚaxisKeys)é   r   ztuple[int | float, ...]ÚfigureSizeDefault)ÚalphaÚcolorBackgroundDataÚcolorBackgroundFigureÚ	colorGridÚcolorsÚ
doneActionÚdpiÚ
figureSizeÚ
fontFamilyÚ	hideXGridÚ	hideYGridÚlabelFontSizeÚmarkerÚ
markersizeÚ
tickColorsÚtickFontSizeÚtitleÚtitleFontSizeÚxTickLabelHorizontalAlignmentÚxTickLabelRotationÚxTickLabelVerticalAlignmentÚkeywordConfigurablesÚreturnÚNonec                óž  — t          ¦   «         }|j        | _        d | _        d | _        d | _        i | _        | j        D ]}i | j        |<   d | j        |         d<   Œd| _        i | _        | j        D ]}d| j        |<   Œd| _	        d | _
        d| _        d| _        d| _        d| _        | j        | _        d| _        d	| _        g d
¢| _        d| _        dddœ| _        d| _        d| _        d| _        d| _        d| _        d| _        d| _        d| _        d| _        d| _        d| _         | j!        D ]}||v rtE          | |||         ¦  «         Œd S )NÚrangeTFçš™™™™™É?z#ffffffz#ddddddzMusic21 GraphÚor   )z#605c7fz#5c7f60z#988969z#628297z#ad776dz#80a364é   ú#000000r   é   é
   Úserifr   ÚcenterÚwrite)#r   ÚpltÚdataÚfigureÚsubplotÚaxisr   ÚgridÚaxisRangeHasBeenSetr   r   r   r   r   r&   r   r   r"   r#   r   r%   r$   r'   r!   r   r   r    r)   r(   r*   ÚhideLeftBottomSpinesÚ_doneActionÚ_dataColorIndexr+   Úsetattr)ÚselfÚkeywordsÚextmÚaxÚaxisKeyÚkws         ú�/Users/tedpeters/Documents/Projects/Claude Projects/Misc Tools/notename-sheets/.venv/lib/python3.11/site-packages/music21/graph/primitives.pyÚ__init__zGraph.__init__„   s”  € Ý!Ñ#Ô#ˆØ”8ˆŒà!%ˆŒ	Ø7;ˆŒØ48ˆŒð &(ˆŒ	Ø”-ð 	*ð 	*ˆBØˆDŒI�b‰MØ%)ˆDŒI�bŒM˜'Ñ"Ð"àˆŒ	Ø46ˆÔ à”}ð 	6ð 	6ˆGØ05ˆDÔ$ WÑ-Ð-àˆŒ
Ø#ˆŒØ(1ˆÔ Ø*3ˆÔ"Ø'ˆŒØ)ˆŒ
Ø37Ô3IˆŒØˆŒØ ˆŒð"
ð "
ð "
ˆŒð "#ˆÔØ09À	Ð*JÐ*JˆŒà"$ˆÔØ"$ˆÔØ&ˆŒØ$ˆŒØ$ˆŒØ'(ˆÔØ2:ˆÔ*Ø08ˆÔ(à*/ˆÔ!à'.ˆÔØ$%ˆÔàÔ+ð 	0ð 	0ˆBØ�Xˆ~ˆ~Ý˜˜b (¨2¤,Ñ/Ô/Ð/øð	0ð 	0ó    c                óz   — t          | d¦  «        r(| j        �#| j                             | j        ¦  «         dS dS dS )z]
        Matplotlib Figure objects need to be explicitly closed when no longer used.
        r;   N)Úhasattrr;   r9   Úclose©rD   s    rJ   Ú__del__zGraph.__del__Á   sI   € õ �4˜Ñ"Ô"ð 	( t¤{Ð'>ØŒH�NŠN˜4œ;Ñ'Ô'Ð'Ð'Ð'ð	(ð 	(Ð'>Ð'>rL   Údictc                ó>   — | j                              ¦   «         }|d= |S )zc
        The wrapper to matplotlib.pyplot stored as self.plt cannot be pickled/deepcopied.
        r9   )Ú__dict__Úcopy)rD   Ústates     rJ   Ú__getstate__zGraph.__getstate__È   s#   € ð ”×"Ò"Ñ$Ô$ˆØ�%ˆLØˆrL   rV   c                ón   — | j                              |¦  «         t          ¦   «         }|j        | _        d S ©N)rT   Úupdater   r9   )rD   rV   rF   s      rJ   Ú__setstate__zGraph.__setstate__Ð   s0   € ØŒ×Ò˜UÑ#Ô#Ð#Ý!Ñ#Ô#ˆØ”8ˆŒˆˆrL   ú
str | Nonec                ó   — | j         S )z{
        returns or sets what should happen when the graph is created (see docs above)
        default is 'write'.
        )rA   rP   s    rJ   r   zGraph.doneActionÕ   s   € ð ÔÐrL   Úactionc                ó@   — |dv r	|| _         d S t          d|› �¦  «        ‚)N)Úshowr8   Nzno such done action: )rA   r   )rD   r^   s     rJ   r   zGraph.doneActionÝ   s3   € àÐ,Ð,Ð,Ø%ˆDÔÐÐå Ð!A¸Ð!AÐ!AÑBÔBÐBrL   Ústrc                óŽ   — t          | j        | j        t          | j        ¦  «        z           ¦  «        }| xj        dz  c_        |S )ah  
        Utility function that cycles through the colors of self.colors.

        >>> g = graph.primitives.Graph()
        >>> g.colors = ['#605c7f', '#5c7f60', '#715c7f']

        >>> g.nextColor()
        '#605c7f'

        >>> g.nextColor()
        '#5c7f60'

        >>> g.nextColor()
        '#715c7f'

        >>> g.nextColor()
        '#605c7f'
        é   )r	   r   rB   Úlen)rD   Úcs     rJ   Ú	nextColorzGraph.nextColorä   sC   € õ& �T”[ Ô!5½¸D¼KÑ8HÔ8HÑ!HÔIÑJÔJˆØÐÔ Ñ!ÐÔØˆrL   rH   Úpairsú%t.Iterable[t.Sequence[object]] | Nonec                óÖ   — |€dS || j         vrt          d|› d�¦  «        ‚g }g }|D ]/\  }}|                     |¦  «         |                     |¦  «         Œ0||f| j         |         d<   dS )a|  
        Set the tick-labels for a given graph or plot's axisKey
        (generally 'x', and 'y') with a set of pairs

        Pairs are iterables of positions and labels.

        N.B. -- both 'x' and 'y' ticks have to be set in
        order to get matplotlib to display either (and presumably 'z' for 3D graphs).

        >>> g = graph.primitives.GraphHorizontalBar()
        >>> g.axis['x']['ticks']
        Traceback (most recent call last):
        KeyError: 'ticks'
        >>> g.axis['x']
        {'range': None}

        >>> g.setTicks('x', [(0, 'a'), (1, 'b')])
        >>> g.axis['x']['ticks']
        ([0, 1], ['a', 'b'])

        >>> g.setTicks('m', [('a', 'b')])
        Traceback (most recent call last):
        music21.graph.utilities.GraphException: Cannot find key 'm' in self.axis

        >>> g.setTicks('x', [])
        >>> g.axis['x']['ticks']
        ([], [])
        NzCannot find key 'z' in self.axisÚticks)r=   r   Úappend)rD   rH   rg   Ú	positionsÚlabelsÚvalueÚlabels          rJ   ÚsetTickszGraph.setTicksû   s—   € ð> ˆ=ØˆFà˜$œ)Ð#Ð#Ý Ð!L°WÐ!LÐ!LÐ!LÑMÔMÐMàˆ	Øˆà!ð 	!ð 	!‰LˆE�5Ø×Ò˜UÑ#Ô#Ð#Ø�MŠM˜%Ñ Ô Ð Ð à&/°Ð&7ˆŒ	�'Ô˜7Ñ#Ð#Ð#rL   r   é   ÚunsortedDataút.Sequence[int | float]Ú	dataStepsÚintc                ó   — t          t          |¦  «        ¦  «        }t          ||z  ¦  «        }g }|dk    rd}t          d|dz   |¦  «        D ]}|                     ||› f¦  «         Œ|                      ||¦  «         dS )a¾  
        Set the ticks for an axis (usually 'y') given unsorted data.

        Data steps shows how many ticks to make from the data.

        >>> g = graph.primitives.GraphHorizontalBar()
        >>> g.setIntegerTicksFromData([10, 5, 3, 8, 20, 11], dataSteps=4)
        >>> g.axis['y']['ticks']
        ([0, 5, 10, 15, 20], ['0', '5', '10', '15', '20'])

        TODO: should this not also use min? instead of always starting from zero?
        rc   é   r   N)ru   ÚmaxÚroundr/   rk   rp   )rD   rr   rH   rt   ÚmaxDataÚtickStepÚtickListr   s           rJ   ÚsetIntegerTicksFromDatazGraph.setIntegerTicksFromData)  s’   € õ  •c˜,Ñ'Ô'Ñ(Ô(ˆÝ˜ 9Ñ,Ñ-Ô-ˆà*,ˆØ�qŠ=ˆ=ØˆHÝ�q˜' A™+ xÑ0Ô0ð 	)ð 	)ˆAØ�OŠO˜Q 1 ˜KÑ(Ô(Ð(Ð(Ø�Š�g˜xÑ(Ô(Ð(Ð(Ð(rL   çš™™™™™¹?Ú
valueRangeútuple[int | float, int | float]ÚpaddingFractionÚfloatc                óÖ   — || j         vrt          d|› �¦  «        ‚|dk    r|d         |d         z
  }||z  }nd}|d         |z
  |d         |z   f| j        |         d<   d| j        |<   dS )aM  
        Set the range for the axis for a given axis key
        (generally, 'x', or 'y')

        ValueRange is a two-element tuple of the lowest
        number and the highest.

        By default, there is a padding of 10% of the range
        in either direction.  Set paddingFraction = 0 to
        eliminate this shift
        úNo such axis exists: r   rc   r/   TN)r   r   r=   r?   )rD   rH   r   r�   Ú
totalRangeÚshifts         rJ   ÚsetAxisRangezGraph.setAxisRangeC  s–   € ð ˜$œ-Ð'Ð'Ý Ð!B¸Ð!BÐ!BÑCÔCÐCà˜aÒÐØ# Aœ¨°A¬Ñ6ˆJØ Ñ0ˆEˆEàˆEà'1°!¤}°uÑ'<Ø'1°!¤}°uÑ'<ð'>ˆŒ	�'Ô˜7Ñ#ð -1ˆÔ  Ñ)Ð)Ð)rL   Fro   ÚconditionalÚboolc                ó¨   — || j         vrt          d|› �¦  «        ‚|r$d| j        |         v r| j        |         d         rd S || j        |         d<   d S )Nr„   ro   )r   r   r=   )rD   rH   ro   rˆ   s       rJ   ÚsetAxisLabelzGraph.setAxisLabel`  sm   € Ø˜$œ-Ð'Ð'Ý Ð!B¸Ð!BÐ!BÑCÔCÐCØð 	˜7 d¤i°Ô&8Ð8Ð8¸T¼YÀwÔ=OÐPWÔ=XÐ8ØˆFà&+ˆŒ	�'Ô˜7Ñ#Ð#Ð#rL   r<   úmatplotlib.axes.AxesÚ
leftBottomc                ó¶  — | j                              ¦   «         D ]L\  }}|dv r|r|                     d¦  «         Œ!|dv r|                     d¦  «         Œ;t          d|› �¦  «        ‚t	          |                      ¦   «         |                      ¦   «         z   ¦  «        D ];\  }}|r|                     d¦  «         Œ|dz  dk    r|                     d¦  «         Œ<dS )	a  
        Remove the right and top spines from the diagram.

        If leftBottom is True, remove the left and bottom spines as well.

        Spines are removed by setting their colors to 'none' and every other
        tick line set_visible to False.
        ©ÚleftÚbottomÚnone)ÚrightÚtopzunknown spine location: Frw   rc   N)ÚspinesÚitemsÚ	set_colorÚ
ValueErrorÚ	enumerateÚget_xticklinesÚget_yticklinesÚset_visible)r<   r�   ÚlocÚspineÚiÚlines         rJ   ÚhideAxisSpineszGraph.hideAxisSpinesh  s  € ð "œ.×.Ò.Ñ0Ô0ð 		Cð 		C‰JˆC�ØÐ(Ð(Ð(Øð ,Ø—O’O FÑ+Ô+Ð+øð Ð(Ð(Ð(Ø—’ Ñ'Ô'Ð'Ð'å Ð!A¸CÐ!AÐ!AÑBÔBÐBõ ! ×!7Ò!7Ñ!9Ô!9¸G×<RÒ<RÑ<TÔ<TÑ!TÑUÔUð 	(ð 	(‰GˆAˆtØð (Ø× Ò  Ñ'Ô'Ð'Ð'Ø�Q‘˜!’�Ø× Ò  Ñ'Ô'Ð'øð		(ð 	(rL   c                ó   — t                                dt          |¦  «        z   ¦  «         |j        }|                     t          | j        ¦  «        ¦  «         | j        D ]}|                      ||¦  «         Œ| j	        r'| 
                    | j	        | j        | j        ¬¦  «         | j        D ]Q}|| j        vrŒ|                     t          j        t          j        d         |¦  «        | j        |         ¬¦  «         ŒR|                      |¦  «         | j        €t)          d¦  «        ‚| j        €J ‚| j                             | j        d         ¦  «         | j                             | j        d         ¦  «         dS )	zµ
        Apply formatting to the Subplot (Axes) container and Figure instance.

        ax should be an AxesSubplot object or
        an Axes3D object or something similar.
        zcalling applyFormatting on ©ÚfontsizeÚfamily)Úbothr   r   )r=   r   Nz>Cannot apply formatting without a figure; call process() firstr   rc   )ÚenvironLocalÚ
printDebugÚreprÚpatchÚset_facecolorr	   r   r   ÚapplyFormattingToOneAxisr&   Ú	set_titler'   r   r$   Útick_paramsÚtÚcastÚLiteralÚ	applyGridr;   r˜   Úset_figwidthr   Úset_figheight)rD   r<   Úrectr=   ÚthisAxisNames        rJ   ÚapplyFormattingzGraph.applyFormatting„  s„  € õ 	×ÒÐ =ÅÀWÁÄÑ MÑNÔNÐNàŒ}ˆà×Ò�8 DÔ$<Ñ=Ô=Ñ>Ô>Ð>ð ”Mð 	9ð 	9ˆDØ×)Ò)¨'°4Ñ8Ô8Ð8Ð8àŒ:ð 	_Ø×Ò˜dœj°4Ô3EÈdÌoÐÑ^Ô^Ð^ð !œMð 	6ð 	6ˆLØ 4¤?Ð2Ð2ØØ×ÒÝ”V�AœIÐ&6Ô7¸ÑFÔFØ” |Ô4ð  ñ 6ô 6ð 6ð 6ð 	�Š�wÑÔÐð Œ;ÐÝÐ]Ñ^Ô^Ð^ØŒ{Ð&Ð&Ð&ØŒ× Ò  ¤°Ô!3Ñ4Ô4Ð4ØŒ×!Ò! $¤/°!Ô"4Ñ5Ô5Ð5Ð5Ð5rL   c                ó(  — | j         rF| j        �?|                     d¦  «         |                      ddt          | j        ¦  «        ¬¦  «         | j        r|j                              d¦  «         | j        r|j                              d¦  «         dS dS )zQ
        Apply the Grid to the subplot such that it goes below the data.
        NTÚmajor)ÚwhichÚcolorF)r>   r   Úset_axisbelowr	   r    Úyaxisr   Úxaxis©rD   r<   s     rJ   r²   zGraph.applyGrid²  sœ   € ð
 Œ9ð 	N˜œÐ3Ø×!Ò! $Ñ'Ô'Ð'Ø�LŠL˜ WµH¸T¼^Ñ4LÔ4LˆLÑMÔMÐMàŒ>ð 	&ØŒM×Ò˜uÑ%Ô%Ð%àŒ>ð 	&ØŒM×Ò˜uÑ%Ô%Ð%Ð%Ð%ð	&ð 	&rL   r=   údict | Nonec           	     ó  — | j         |         }|dvrdS d|v rH|d         �@d|z   dz   }t          | j        ¦  «        dk    r|dz  }t          ||¦  «        } ||d         Ž  d|v r<|d         �4t          |d|z   dz   ¦  «        } ||d         | j        | j        ¬	¦  «         d
|v r/|d
         �'t          |d|z   d
z   ¦  «        } ||d
         ¦  «         	 t          |d|z   dz   ¦  «        }t          |d|z   dz   ¦  «        }t          |d|z   dz   ¦  «        }	n# t          $ r	 d}d}d}	Y nw xY wd|vr0|	�. |¦   «         }
 ||
¦  «          |	|
| j        | j        ¬	¦  «         n¦|d         \  }}|� ||¦  «         |dk    r6|                     || j        | j        | j	        | j
        | j        d¬¦  «         nR|dk    r%|                     || j        | j        dd¬¦  «         n't          |	¦  «        r |	|| j        | j        ¬	¦  «         |S )al  
        Given a matplotlib.Axes object (a subplot) and a string of
        'x', 'y', or 'z', set the Axes object's xlim (or ylim or zlim or xlim3d, etc.) from
        self.axis[axis]['range'], Set the label from self.axis[axis]['label'],
        the scale, the ticks, and the ticklabels.

        Returns the matplotlib Axis object that has been modified
        ©r   r   ÚzNr/   Úset_Úlimé   Ú3dro   r£   ÚscaleÚget_rj   Ú
ticklabelsr   g{®Gáz„¿)r¤   r¥   ÚhorizontalalignmentÚverticalalignmentÚrotationr   r   r“   r7   ©r¤   r¥   rË   rÌ   )r=   rd   r   Úgetattrr!   r   ÚAttributeErrorr%   Úset_xticklabelsr(   r*   r)   Úset_yticklabelsÚcallable)rD   r<   r=   ÚthisAxisÚrangeFuncNameÚthisRangeFuncÚsetLabelFunctionÚgetTickFunctionÚsetTickFunctionÚsetTickLabelFunctionrj   Úvaluesrm   s                rJ   r¬   zGraph.applyFormattingToOneAxisÂ  sû  € ð ”9˜T”?ˆØ�Ð&Ð&Ø�4à�hÐÐ 8¨GÔ#4Ð#@Ø" T™M¨EÑ1ˆMÝ�4”=Ñ!Ô! QÒ&Ð&Ø Ñ%�Ý# G¨]Ñ;Ô;ˆMØˆM˜8 GÔ,Ð-Ð-à�hÐÐ 8¨GÔ#4Ð#@å& w°¸±ÀÑ0GÑHÔHÐØÐ˜X gÔ.Ø&*Ô&8ÀÄðRñ Rô Rð Rð �hÐÐ 8¨GÔ#4Ð#@å& w°¸±ÀÑ0GÑHÔHÐØÐ˜X gÔ.Ñ/Ô/Ð/ð	(Ý% g¨v¸©}¸wÑ/FÑGÔGˆOÝ% g¨v¸©}¸wÑ/FÑGÔGˆOÝ#*¨7°F¸T±MÀLÑ4PÑ#QÔ#QÐ Ð øÝð 	(ð 	(ð 	(à"ˆOØ"ˆOØ#'Ð Ð Ð ð		(øøøð ˜(Ð"Ð"Ð';Ð'Gà#�OÑ%Ô%ˆEØˆO˜EÑ"Ô"Ð"Ø Ð  Ø*.Ô*;Ø(,¬ð9ñ 9ô 9ð 9ð 9ð & gÔ.‰NˆF�FØÐ*Ø� Ñ'Ô'Ð'Ø�sŠ{ˆ{Ø×'Ò'¨Ø15Ô1BØ/3¬Ø<@Ô<^Ø:>Ô:ZØ15Ô1HØ*/ð (ñ 1ô 1ð 1ð 1ð ˜’�Ø×'Ò'¨Ø15Ô1BØ/3¬Ø<CØ:Bð	 (ñ Dô Dð Dð Dõ
 Ð.Ñ/Ô/ð =à$Ð$ VØ.2Ô.?Ø,0¬Oð=ñ =ô =ð =ð ˆs   ÃAD ÄD*Ä)D*c                ó’  — t          ¦   «         }|j        }|                     | j        ¬¦  «        | _        | j                             ddd¦  «        | _        d| _        |                      | j        ¦  «         |                      | j        | j	        ¬¦  «         |  
                    | j        ¦  «         |                      ¦   «          dS )a  
        Creates the figure and subplot, calls renderSubplot to get the
        subclass specific information on the data, runs hideAxisSpines,
        applyFormatting, and then calls the done action.  Returns None,
        but the subplot is available at self.subplot
        )Ú	facecolorrc   r   )r�   N)r   r9   r;   r   Úadd_subplotr<   rB   ÚrenderSubplotr¡   r@   r·   ÚcallDoneAction©rD   rF   r9   s      rJ   ÚprocesszGraph.process  s·   € õ "Ñ#Ô#ˆØŒhˆð
 —j’j¨4Ô+E�jÑFÔFˆŒØ”{×.Ò.¨q°!°QÑ7Ô7ˆŒà ˆÔà×Ò˜4œ<Ñ(Ô(Ð(ð 	×Ò˜DœL°TÔ5NÐÑOÔOÐOØ×Ò˜Tœ\Ñ*Ô*Ð*Ø×ÒÑÔÐÐÐrL   c                ó   — dS )zI
        Calls the subclass specific information to get the data
        N© r¿   s     rJ   rß   zGraph.renderSubplot*  s	   € ð 	ˆrL   NÚfpc                óž   — | j         dk    r|                      ¦   «          dS | j         dk    r|                      |¦  «         dS | j         €dS dS )zI
        Implement the desired doneAction, after data processing
        r`   r8   N)r   r`   r8   )rD   rå   s     rJ   rà   zGraph.callDoneAction1  sW   € ð Œ?˜fÒ$Ð$Ø�IŠI‰KŒKˆKˆKˆKØŒ_ Ò'Ð'Ø�JŠJ�r‰NŒNˆNˆNˆNØŒ_Ð$ØˆDð %Ð$rL   c                óv   — | j         €t          d¦  «        ‚| j         €J ‚| j                              ¦   «          dS )z¤
        Calls the show() method of the matplotlib plot.
        For most matplotlib back ends, this will open
        a GUI window with the desired graph.
        Nz8Cannot show graph without a figure; call process() first)r;   r˜   r`   rP   s    rJ   r`   z
Graph.show<  sC   € ð Œ;ÐÝÐWÑXÔXÐXØŒ{Ð&Ð&Ð&ØŒ×ÒÑÔÐÐÐrL   ústr | pathlib.Path | Noneúmatplotlib.figure.Figure | Nonec                óh  — | j         €t          d¦  «        ‚| j         €J ‚|€t                               d¦  «        }| j        }|€d}| j                              ||¬¦  «         t          j        ¦   «         s7t          ¦   «          	                    t          j        |¦  «        d¬¦  «         dS | j         S )za
        Writes the graph to a file. If no file path is given, a temporary file is used.
        Nz9Cannot write graph without a figure; call process() firstú.pngé,  )r   Úpng)Úfmt)r;   r˜   r§   ÚgetTempFiler   Úsavefigr   ÚrunningInNotebookr   ÚlaunchÚpathlibÚPath)rD   rå   r   s      rJ   r8   zGraph.writeG  s¿   € ð Œ;ÐÝÐXÑYÔYÐYØŒ{Ð&Ð&Ð&Øˆ:Ý×)Ò)¨&Ñ1Ô1ˆBàŒhˆØˆ;ØˆCàŒ×Ò˜Bð !$ð 	ñ 	%ô 	%ð 	%õ
 Ô'Ñ)Ô)ð 	Ý‰NŒN×!Ò!¥'¤,¨rÑ"2Ô"2¸Ð!Ñ>Ô>Ð>Ø�4à”;ÐrL   ©r,   r-   )r,   rR   )rV   rR   r,   r-   )r,   r\   )r^   r\   r,   r-   )r,   ra   )rH   ra   rg   rh   r,   r-   )r   rq   )rr   rs   rH   ra   rt   ru   r,   r-   )r~   )rH   ra   r   r€   r�   r‚   r,   r-   )F)rH   ra   ro   ra   rˆ   r‰   r,   r-   )r<   rŒ   r�   r‰   r,   r-   ©r<   rŒ   r,   r-   )r<   rŒ   r=   ra   r,   rÀ   rY   )rå   r\   r,   r-   )rå   rè   r,   ré   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú	graphTyper   Ú__annotations__r   r+   rK   rQ   rW   r[   Úpropertyr   Úsetterrf   rp   r}   r‡   r‹   Ústaticmethodr¡   r·   r²   r¬   râ   rß   rà   r`   r8   rä   rL   rJ   r   r   2   s[  € € € € € € ð4ð 4ðj €IØ *€HÐ*Ð*Ð*Ñ*Ø/5ÐÐ5Ð5Ð5Ñ5ð-Ðð ð ð ñ ð0;0ð ;0ð ;0ð ;0ðz(ð (ð (ð (ðð ð ð ðð ð ð ð
 ð ð  ð  ñ „Xð ð ÔðCð Cð Cñ ÔðCðð ð ð ð.,8ð ,8ð ,8ð ,8ð` 03Ø12ð)ð )ð )ð )ð )ð: /2ð1ð 1ð 1ð 1ð 1ð:,ð ,ð ,ð ,ð ,ð ð(ð (ð (ð (ñ „\ð(ð6(6ð (6ð (6ð (6ð\&ð &ð &ð &ð Kð Kð Kð KðZð ð ð ð6ð ð ð ð	ð 	ð 	ð 	ð 	ð	ð 	ð 	ð 	ð /3ðð ð ð ð ð ð rL   r   c                  óf   ‡ — e Zd ZU dZddiZded<   dZdZej	        dz   Z	d	ed
<   dˆ fd„Z
dd„Zˆ xZS )ÚGraphColorGrida°  
    Grid of discrete colored "blocks" to visualize results of a windowed analysis routine.

    Data is provided as a list of lists of colors, where colors are specified as a hex triplet,
    or the common HTML color codes, and based on analysis-specific mapping of colors to results.

    >>> #_DOCS_SHOW g = graph.primitives.GraphColorGrid()
    >>> g = graph.primitives.GraphColorGrid(doneAction=None) #_DOCS_HIDE
    >>> data = [['#55FF00', '#9b0000', '#009b00'],
    ...         ['#FFD600', '#FF5600'],
    ...         ['#201a2b', '#8f73bf', '#a080d5', '#403355', '#999999']]
    >>> g.data = data
    >>> g.process()

    .. image:: images/GraphColorGrid.*
        :width: 600
    r@   ú:bool to hide the left and bottom axis spines; default Trueúdict[str, str]Ú	_DOC_ATTRr   )é	   r   ©r@   r   r+   r,   r-   c                óH   •— d| _          t          ¦   «         j        di |¤Ž d S )NTrä   )r@   ÚsuperrK   ©rD   rE   Ú	__class__s     €rJ   rK   zGraphColorGrid.__init__}  s.   ø€ Ø$(ˆÔ!Ø�‰ŒÔÐ$Ð$˜8Ð$Ð$Ð$Ð$Ð$rL   r<   rŒ   c           
     ó˜  — | j         €t          d¦  «        ‚| j         €J ‚| j        €t          d¦  «        ‚| j        €J ‚| j                              d¬¦  «         t	          | j        ¦  «        }t          |¦  «        D �]n}| j        |         }g }g }g }t          |¦  «        D ]G\  }}	|                     |dz   ¦  «         |                     |	¦  «         |                     d¦  «         ŒH| j                              |d||z
  ¦  «        }
|
 	                    ||d|ddd	¬
¦  «         |
j
                             ¦   «         D ]D\  }}|                     d¦  «         |                     d¦  «         |                     d¦  «         ŒEt          |
                     ¦   «         |
                     ¦   «         z   ¦  «        D ]\  }}|                     d	¦  «         Œ|
                     g ¦  «         |
                     g ¦  «         |
                     dgt	          |
                     ¦   «         ¦  «        z  ¦  «         |
                     dgt	          |
                     ¦   «         ¦  «        z  ¦  «         |
                     dt	          | j        |         ¦  «        f¦  «         |
                     ¦   «                              d	¦  «         |
                     ¦   «                              d	¦  «         �Œp|dk    r| j                              d¬¦  «         n| j                              d¬¦  «         d}|                      d|d¦  «         d	| _        d S )Nú<Cannot render subplot without a figure; call process() firstúJCannot render subplot without data; set self.data before calling process()ç333333Ã?©r�   ç      à?rc   ç333333Ó?r3   F)r»   Ú	linewidthÚ	edgecolorÚantialiasedÚ r   r4   )Úhspacer~   ©r   rc   r   )r;   r˜   r:   Úsubplots_adjustrd   r/   r™   rk   rÞ   Úbarr•   r–   Úset_linewidthr—   Ú	set_alpharš   r›   rœ   Ú
set_xticksÚ
set_yticksrÒ   Úget_yticklabelsrÑ   Úget_xticklabelsÚset_xlimÚ	get_xaxisÚ	get_yaxisr‡   r>   )rD   r<   ÚrowCountrŸ   ÚthisRowDatarl   ÚheightsÚ	subColorsÚjÚ	thisColorrG   Ú
unused_locrž   r    ÚaxisRangeNumberss                  rJ   rß   zGraphColorGrid.renderSubplot�  sY  € àŒ;ÐÝÐ[Ñ\Ô\Ð\ØŒ{Ð&Ð&Ð&ØŒ9ÐÝð Fñ Gô Gð GàŒyÐ$Ð$Ð$ð 	Œ×#Ò#¨Ð#Ñ.Ô.Ð.å�t”y‘>”>ˆå�x‘”ð .	.ñ .	.ˆAØœ) Aœ,ˆKàˆIØˆGØˆIå )¨+Ñ 6Ô 6ð "ð "‘��9Ø× Ò   U¡Ñ+Ô+Ð+à× Ò  Ñ+Ô+Ð+à—’˜qÑ!Ô!Ð!Ð!ð ”×(Ò(¨°1°hÀ±lÑCÔCˆBð �FŠF�9ØØØ"Ø Ø&Ø$ð ñ &ô &ð &ð &(¤Y§_¢_Ñ%6Ô%6ð #ð #Ñ!�
˜Eà×#Ò# CÑ(Ô(Ð(Ø—’ 	Ñ*Ô*Ð*Ø—’ Ñ"Ô"Ð"Ð"õ % R×%6Ò%6Ñ%8Ô%8¸2×;LÒ;LÑ;NÔ;NÑ%NÑOÔOð (ð (‘��4Ø× Ò  Ñ'Ô'Ð'Ð'Ø�MŠM˜"ÑÔÐØ�MŠM˜"ÑÔÐØ×Ò ˜t¥c¨"×*<Ò*<Ñ*>Ô*>Ñ&?Ô&?Ñ?Ñ@Ô@Ð@Ø×Ò ˜t¥c¨"×*<Ò*<Ñ*>Ô*>Ñ&?Ô&?Ñ?Ñ@Ô@Ð@à�KŠK˜�C ¤	¨!¤Ñ-Ô-Ð.Ñ/Ô/Ð/ð �LŠL‰NŒN×&Ò& uÑ-Ô-Ð-Ø�LŠL‰NŒN×&Ò& uÑ-Ô-Ð-Ñ-ð �bŠ=ˆ=ØŒK×'Ò'¨qÐ'Ñ1Ô1Ð1Ð1àŒK×'Ò'¨sÐ'Ñ3Ô3Ð3à!ÐØ×Ò˜#Ð/°Ñ3Ô3Ð3ð ˆŒ	ˆ	ˆ	rL   rõ   rö   )r÷   rø   rù   rú   r  rü   rû   r   r   r+   rK   rß   Ú__classcell__©r
  s   @rJ   r  r  c  s°   ø€ € € € € € ðð ð$ 	Ð \ð!€Ið ð ð ñ ð €IØÐØ,1Ô,FÐIbÑ,bÐÐbÐbÐbÑbð%ð %ð %ð %ð %ð %ðPð Pð Pð Pð Pð Pð Pð PrL   r  c                  ón   ‡ — e Zd ZU dZddiZded<   dZdZej	        dz   Z	d	ed
<   dˆ fd„Z
dd„Zdd„Zˆ xZS )ÚGraphColorGridLegendaÐ  
    Grid of discrete colored "blocks" where each block can be labeled

    Data is provided as a list of lists of colors, where colors are specified as a hex triplet,
    or the common HTML color codes, and based on analysis-specific mapping of colors to results.

    >>> #_DOCS_SHOW g = graph.primitives.GraphColorGridLegend()
    >>> g = graph.primitives.GraphColorGridLegend(doneAction=None) #_DOCS_HIDE
    >>> data = [
    ...         ('Major', [('C#', '#00aa55'), ('D-', '#5600ff'), ('G#', '#2b00ff')]),
    ...         ('Minor', [('C#', '#004600'), ('D-', '#00009b'), ('G#', '#00009b')])
    ... ]
    >>> g.data = data
    >>> g.process()

    .. image:: images/GraphColorGridLegend.*
        :width: 600

    r@   r  r  r  ÚcolorGridLegend)é   ç      ø?r  r   r+   r,   r-   c                ób   •— d| _          t          ¦   «         j        di |¤Ž d|vr	d| _        d S d S )NTr&   ÚLegendrä   )r@   r  rK   r&   r	  s     €rJ   rK   zGraphColorGridLegend.__init__ð  sF   ø€ Ø$(ˆÔ!à�‰ŒÔÐ$Ð$˜8Ð$Ð$Ð$à˜(Ð"Ð"Ø!ˆDŒJˆJˆJð #Ð"rL   r<   rŒ   c                óÎ  — | j         €t          d¦  «        ‚| j         €J ‚| j        €t          d¦  «        ‚| j        €J ‚t          | j        ¦  «        D ]2\  }}|d         }|d         }|                      | j         |||¦  «         Œ3|                      ddd¦  «         |                     ¦   «         |                     ¦   «         z   }t          |¦  «        D ]\  }}|                     d¦  «         Œ| j          	                    dd	d
¬¦  «         |  
                    dd¦  «         |  
                    dd¦  «         |                      dg ¦  «         |                      dg ¦  «         d S )Nr  r  r   rc   r   r  Fr1  g      è?r0   )r  r”   r‘   r   r  )r;   r˜   r:   r™   ÚmakeOneRowOfGraphr‡   rš   r›   rœ   r  r‹   rp   )	rD   r<   rŸ   ÚrowLabelAndDataÚrowLabelÚrowDataÚallTickLinesr'  r    s	            rJ   rß   z"GraphColorGridLegend.renderSubplotø  s�  € ØŒ;ÐÝÐ[Ñ\Ô\Ð\ØŒ{Ð&Ð&Ð&ØŒ9ÐÝð Fñ Gô Gð GàŒyÐ$Ð$Ð$Ý"+¨D¬IÑ"6Ô"6ð 	Fð 	FÑˆAˆØ& qÔ)ˆHØ% aÔ(ˆGØ×"Ò" 4¤;°°8¸WÑEÔEÐEÐEà×Ò˜#˜v qÑ)Ô)Ð)à×-Ò-Ñ/Ô/°'×2HÒ2HÑ2JÔ2JÑJˆÝ  Ñ.Ô.ð 	$ð 	$‰GˆAˆtØ×Ò˜UÑ#Ô#Ð#Ð#ð 	Œ×#Ò#¨3°DÀÐ#ÑEÔEÐEà×Ò˜#˜rÑ"Ô"Ð"Ø×Ò˜#˜rÑ"Ô"Ð"Ø�Š�c˜2ÑÔÐØ�Š�c˜2ÑÔÐÐÐrL   r;   úmatplotlib.figure.FigureÚrowIndexru   r7  ra   r8  úlist[tuple[str, str]]c                óV  — | j         €t          d¦  «        ‚| j         €J ‚g }g }g }t          |¦  «        D ]M\  }}	|                     d|z   ¦  «         |                     |	d         ¦  «         |                     d¦  «         ŒNt	          | j         ¦  «        d|dz   f}
 |j        |
Ž }d}|                     ||||dd¬¦  «         |j                             ¦   «         D ],}| 	                    d¦  «         | 
                    d¦  «         Œ-|                     ¦   «         |                     ¦   «         z   }t          |¦  «        D ]\  }}|                     d¦  «         Œ|                     d	g¦  «         |                     |g| j        | j        d
d¬¦  «         |                     d„ t'          t	          |¦  «        ¦  «        D ¦   «         ¦  «         d„ |D ¦   «         }|                     || j        | j        ddd¬¦  «         |                     d	t	          |¦  «        d	z   f¦  «         |S )a  
        Makes a subplot for one row of data (such as for the Major label)
        and returns a matplotlib.axes.AxesSubplot instance representing the subplot.

        Here we create an axis with a part of Scriabin's mapping of colors
        to keys in Prometheus: The Poem of Fire.

        >>> import matplotlib.pyplot

        >>> colorLegend = graph.primitives.GraphColorGridLegend()
        >>> rowData = [('C', '#ff0000'), ('G', '#ff8800'), ('D', '#ffff00'),
        ...            ('A', '#00ff00'), ('E', '#4444ff')]
        >>> colorLegend.data = [['Scriabin Mapping', rowData]]

        >>> fig = matplotlib.pyplot.figure()
        >>> subplot = colorLegend.makeOneRowOfGraph(fig, 0, 'Scriabin Mapping', rowData)
        >>> subplot
        <Axes: >
        NzOCannot create row of graph without data; set self.data before calling process()ç      ð?rc   r  r3   )r»   r  r  Fr  r“   r7   rÎ   c                ó   — g | ]}|d z   ‘ŒS ©rc   rä   ©Ú.0r   s     rJ   ú
<listcomp>z:GraphColorGridLegend.makeOneRowOfGraph.<locals>.<listcomp>\  s   € Ð:Ð:Ð: �q˜1‘uÐ:Ð:Ð:rL   c                ó2   — g | ]\  }}t          |¦  «        ‘ŒS rä   )r
   )rB  r   Úunused_ys      rJ   rC  z:GraphColorGridLegend.makeOneRowOfGraph.<locals>.<listcomp>_  s;   € ð 'Cð 'Cð 'CÙ+6¨1¨hõ (@ÀÑ'BÔ'Bð 'Cð 'Cð 'CrL   gš™™™™™Ù¿)r¤   r¥   rË   rÌ   r   )r:   r˜   r™   rk   rd   rÞ   r  r•   rÛ   r  r—   rš   r›   rœ   r  rÒ   r%   r   r  r/   rÑ   r   )rD   r;   r;  r7  r8  rl   r%  r&  r'  ÚoneColorMappingÚ	posTriplerG   ÚwidthÚspineArtistr9  r    ÚsubstitutedAccidentalLabelss                    rJ   r5  z&GraphColorGridLegend.makeOneRowOfGraph  s‘  € ð2 Œ9ÐÝð Fñ Gô Gð GàŒyÐ$Ð$Ð$ð ˆ	ØˆØˆ	å"+¨GÑ"4Ô"4ð 	ð 	ÑˆAˆØ×Ò˜S 1™WÑ%Ô%Ð%Ø×Ò˜_¨QÔ/Ñ0Ô0Ð0Ø�NŠN˜1ÑÔÐÐõ ˜œ‘^”^ Q¨°1©Ð5ˆ	àˆVÔ Ð+ˆð ˆØ
�Šˆy˜' 5°	ÀSÐT]ˆÑ^Ô^Ð^ð œ9×+Ò+Ñ-Ô-ð 	-ð 	-ˆKà×%Ò% cÑ*Ô*Ð*Ø×!Ò! )Ñ,Ô,Ð,Ð,ð ×(Ò(Ñ*Ô*¨R×->Ò->Ñ-@Ô-@Ñ@ˆÝ  Ñ.Ô.ð 	$ð 	$‰GˆAˆtØ×Ò˜UÑ#Ô#Ð#Ð#ð 	�Š�s�eÑÔÐØ
×Ò˜H˜:Ø$(Ô$5Ø"&¤/Ø/6Ø-5ð	 	ñ 	7ô 	7ð 	7ð 	�ŠÐ:Ð:¥e­C°©L¬LÑ&9Ô&9Ð:Ñ:Ô:Ñ;Ô;Ð;ð'Cð 'CØ:Að'Cñ 'Cô 'CÐ#à
×ÒØ'ØÔ&Ø”?Ø (Ø&Øð 	ñ 	ô 	ð 	ð 	�Š�S�#˜g™,œ,¨Ñ,Ð-Ñ.Ô.Ð.àˆ	rL   rõ   rö   )
r;   r:  r;  ru   r7  ra   r8  r<  r,   rŒ   )r÷   rø   rù   rú   r  rü   rû   r   r   r+   rK   rß   r5  r+  r,  s   @rJ   r.  r.  Ô  sÄ   ø€ € € € € € ðð ð( 	Ð \ð!€Ið ð ð ñ ð "€IØ ÐØ,1Ô,FÐIbÑ,bÐÐbÐbÐbÑbð"ð "ð "ð "ð "ð "ðð ð ð ð<Uð Uð Uð Uð Uð Uð Uð UrL   r.  c                  ó~   ‡ — e Zd ZU dZdddœZded<   dZdZej	        dz   Z	d	ed
<   dˆ fd„Z
ed„ ¦   «         Zdd„Zˆ xZS )ÚGraphHorizontalBaraÝ  
    Numerous horizontal bars in discrete channels, where bars
    can be incomplete and/or overlap.

    Data provided is a list of pairs, where the first value becomes the key,
    the second value is a list of x-start, x-length values.

    Note how the second element in each data point is the length, so
    subtracting death year from birth year gives the appropriate length.

    Example: Plot the life-span of four composers whose lives were intertwined:
    Chopin, Robert and Clara Schumann, and Brahms.

    >>> a = graph.primitives.GraphHorizontalBar()
    >>> a.doneAction = None #_DOCS_HIDE
    >>> data = [('Chopin', [(1810, 1849-1810)]),
    ...         ('Schumanns', [(1810, 1856-1810), (1819, 1896-1819)]),
    ...         ('Brahms', [(1833, 1897-1833)])]
    >>> a.data = data
    >>> a.process()

    .. image:: images/GraphHorizontalBar.*
        :width: 600

    Data is a list of tuples in the form, where each entry represents a space on the
    Y axis:

        * Label
        * List of tuples of numeric data where each tuple has two or three elements:
            * Start x-position
            * Length of bar
            * Optional: dictionary of format information about this point.
        * Optional: dictionary of format information for all points at this level.
          (this will be overridden by any information for the particular point)

    To make an equally spaced plot, like in a Pitch Space plot, leave empty data in the form:

        `('', [], {})`

    ú2Amount of vertical space each bar takes; default 8zj
            Vertical space above and below the bars, default 2 (= total4 space between bars)
            ©ÚbarSpaceÚmarginr  r  ÚhorizontalBar©r5   é   r   r+   r,   r-   c                óp   •— d| _         d| _         t          ¦   «         j        di |¤Ž d|vr	d| _        d S d S )Nrq   rw   r   ç333333ã?rä   ©rO  rP  r  rK   r   r	  s     €rJ   rK   zGraphHorizontalBar.__init__¥  sL   ø€ ØˆŒØˆŒà�‰ŒÔÐ$Ð$˜8Ð$Ð$Ð$à˜(Ð"Ð"ØˆDŒJˆJˆJð #Ð"rL   c                ó&   — | j         | j        dz  z
  S ©Nrw   rN  rP   s    rJ   Ú	barHeightzGraphHorizontalBar.barHeight®  ó   € àŒ} ¤¨a¡Ñ0Ð0rL   r<   rŒ   c                óx  ‡— | j         €t          d¦  «        ‚| j         €J ‚| j        €t          d¦  «        ‚| j        €J ‚| j                              d¬¦  «         d}t	          ¦   «         }g }g }g }d}| j        D �]j}t          |¦  «        dk    r|\  }	}
i }n|\  }	}
}|                     |	¦  «         |                     d|                      ¦   «         ¦  «        Š|
rÖt          |
d         ¦  «        dk    }|r‰}|
}nˆfd„|
D ¦   «         }d	„ |
D ¦   «         }|| j	        z   | j
        f}|                     |||| j        ¬
¦  «         |
D ]j}t          |¦  «        dk    r|d d…         \  }}n"t          dt          |¦  «        › d|› �¦  «        ‚||z   }||fD ]}||vr|                     |¦  «         ŒŒk|                     || j        dz  z   |	g¦  «         || j        z  }|dz  }�Œld}d}|rt          |¦  «        }t!          |¦  «        }||z
  }|                      ddt          |¦  «        | j        z  f¦  «         |                      d||f¦  «         |                      d|¦  «         d| j        d         v r¿| j        d         d         s®t)          |t+          |dz  ¦  «        z   ¦  «        }|dk    rd}t-          t)          t/          j        |¦  «        ¦  «        t+          t/          j        |¦  «        ¦  «        |¦  «        D ]}|                     ||› g¦  «         Œ|                      d|¦  «         d S d S d S )Nr  r  r  r  r   rw   r»   c                óH   •— g | ]}|d                                d‰¦  «        ‘ŒS )rw   r»   )Úget)rB  ÚpÚ	faceColors     €rJ   rC  z4GraphHorizontalBar.renderSubplot.<locals>.<listcomp>Ö  s+   ø€ Ð$RÐ$RÐ$RÀa Q q¤T§X¢X¨g°yÑ%AÔ%AÐ$RÐ$RÐ$RrL   c                ó"   — g | ]}|d d…         ‘ŒS rX  rä   )rB  r^  s     rJ   rC  z4GraphHorizontalBar.renderSubplot.<locals>.<listcomp>×  s    € Ð%<Ð%<Ð%<° a¨¨¨¤eÐ%<Ð%<Ð%<rL   )Ú
facecolorsr   z"Points must be length 2 or 3, not z: r  rc   ç        r   r   rj   r5   )r;   r˜   r:   r  Úsetrd   rk   r]  rf   rP  rY  Úbroken_barhr   ÚaddrO  Úminrx   r‡   rp   r=   ru   ry   r/   ÚmathÚfloorÚceil)rD   r<   ÚyPosÚxPointsÚyTicksÚxTicksÚkeysrŸ   ÚinfoÚkeyÚpointsÚfullRowFormatDictÚuniformFormatPerRowÚrowFaceColorsÚpositionPointsÚyRanger^  ÚxStartÚxLenÚxEndr   ÚxMinÚxMaxÚxRangeÚ	rangeStepr_  s                            @rJ   rß   z GraphHorizontalBar.renderSubplot²  s×  ø€ ØŒ;ÐÝÐ[Ñ\Ô\Ð\ØŒ{Ð&Ð&Ð&ØŒ9ÐÝð Fñ Gô Gð GàŒyÐ$Ð$Ð$ØŒ×#Ò#¨Ð#Ñ.Ô.Ð.àˆÝ"%¡%¤%ˆØˆØˆàˆØˆà”Ið *	ñ *	ˆDÝ�4‰yŒy˜AŠ~ˆ~Ø"‘��VØ$&Ð!Ð!à15Ñ.��VÐ.Ø�KŠK˜ÑÔÐð *×-Ò-¨g°t·~²~Ñ7GÔ7GÑHÔHˆIàð +Ý'*¨6°!¬9¡~¤~¸Ò':Ð#à&ð =Ø$-�MØ%+�N�Nà$RÐ$RÐ$RÐ$RÈ6Ð$RÑ$RÔ$R�MØ%<Ð%<°VÐ%<Ñ%<Ô%<�Nà ¤Ñ,Øœ.ð*�ð ×#Ò# NØ$*Ø/<Ø*.¬*ð $ñ 6ô 6ð 6ð  ð 	+ð 	+�AÝ˜1‘v”v ’{�{Ø'(¨¨!¨¤u™˜  å(Ð)[ÍcÐRSÉfÌfÐ)[Ð)[ÐXYÐ)[Ð)[Ñ\Ô\Ð\à! D™=�DØ$ d˜^ð +ð +˜Ø GÐ+Ð+Ø#ŸKšK¨™NœN˜Nøð+ð �MŠM˜4 $¤-°#Ñ"5Ñ5°sÐ;Ñ<Ô<Ð<à�D”MÑ!ˆDØ�‰FˆA‰AàˆØˆØð 	 Ý�w‘<”<ˆDÝ�w‘<”<ˆDØ˜‘ˆð 	×Ò˜# ¥3 t¡9¤9¨t¬}Ñ#<Ð=Ñ>Ô>Ð>Ø×Ò˜#  d˜|Ñ,Ô,Ð,Ø�Š�c˜6Ñ"Ô"Ð"ð �d”i ”nÐ$Ð$¨T¬Y°s¬^¸GÔ-DÐ$Ý˜D¥5¨°"©Ñ#5Ô#5Ñ5Ñ6Ô6ˆIØ˜AŠ~ˆ~Ø�	Ý�3�tœz¨$Ñ/Ô/Ñ0Ô0Ý ¥¤¨4¡¤Ñ1Ô1Ø$ñ&ô &ð +ð +�ð —’˜q Q &˜kÑ*Ô*Ð*Ð*Ø�MŠM˜#˜vÑ&Ô&Ð&Ð&Ð&ð %Ð$Ð$Ð$rL   rõ   rö   ©r÷   rø   rù   rú   r  rü   rû   r   r   r+   rK   rý   rY  rß   r+  r,  s   @rJ   rL  rL  n  sá   ø€ € € € € € ð'ð 'ðR Iðð!ð !€Ið ð ð ñ ð  €IØÐØ,1Ô,Fð Jñ -Ðð ð ð ñ ð
ð ð ð ð ð ð ð1ð 1ñ „Xð1ðS'ð S'ð S'ð S'ð S'ð S'ð S'ð S'rL   rL  c                  ó~   ‡ — e Zd ZU dZdddœZded<   dZdZej	        dz   Z	d	ed
<   dˆ fd„Z
ed„ ¦   «         Zdd„Zˆ xZS )ÚGraphHorizontalBarWeightedz¼
    Numerous horizontal bars in discrete channels,
    where bars can be incomplete and/or overlap, and
    can have different heights and colors within their
    respective channel.
    rM  z Space around the bars, default 2rN  r  r  ÚhorizontalBarWeightedrR  r   r+   r,   r-   c                óp   •— d| _         d| _         t          ¦   «         j        di |¤Ž d|vr	d| _        d S d S )Nrq   ç      Ð?r   rc   rä   rV  r	  s     €rJ   rK   z#GraphHorizontalBarWeighted.__init__  sN   ø€ ØˆŒØ!ˆŒà�‰ŒÔÐ$Ð$˜8Ð$Ð$Ð$ð ˜(Ð"Ð"ØˆDŒJˆJˆJð #Ð"rL   c                ó&   — | j         | j        dz  z
  S rX  rN  rP   s    rJ   rY  z$GraphHorizontalBarWeighted.barHeight.  rZ  rL   r<   rŒ   c           
     ó¤  — | j         €t          d¦  «        ‚| j         €J ‚| j        €t          d¦  «        ‚| j        €J ‚| j                              d¬¦  «         d}g }g }g }d}t	          | j        ¦  «        | _        | j                             ¦   «          | j        D �]4\  }}|                     |¦  «         g }	g }
g }g }t          |¦  «        D �]‡\  }}d}d }d}|                      ¦   «         }| j	        }d}t          |¦  «        dk    r|\  }}}nSt          |¦  «        dk    r|\  }}}}n8t          |¦  «        d	k    r	|\  }}}}}nt          |¦  «        d
k    r	|\  }}}}}}t          |¦  «        }|€t          d|› �¦  «        ‚|€J ‚|	                     ||f¦  «         |                     |¦  «         |                     |¦  «         ||vr|                     |¦  «         ||z   |vr|                     ||z   ¦  «         | j        |z  }| j        |z
  dz  }| j        d|z
  z  dz  }|| j        z   |z   ||z  z   }|
                     ||f¦  «         �Œ‰t          |	¦  «        D ]8\  }}|                     |g|
|         ||         ||         ||         ¬¦  «         Œ9|                     || j        dz  z   |g¦  «         || j        z  }|dz  }�Œ6t!          |¦  «        }t#          |¦  «        }|                      ddt          |¦  «        | j        z  fd¬¦  «         |                      d||fd¬¦  «         |                      d|¦  «         d S )Nr  r  r  r  r   rc   rÆ   rS  r0  r   zLData point must have at least 3 elements (x, span, heightScalar, ...); got: r  )ra  r   r  r   çš™™™™™©?)r�   r   g{®Gáz„?)r;   r˜   r:   r  ÚlistÚreverserk   r™   rf   r   rd   r	   rY  rP  rd  rO  rf  rx   r‡   rp   )rD   r<   rj  rk  rl  rn  rŸ   rp  rq  ÚxRangesÚyRangesÚalphasr   r:   r   ÚspanÚheightScalarr»   r   ÚyShiftÚhÚyAdjustÚ
yShiftUnitÚ	adjustedYr|  rz  r{  s                              rJ   rß   z(GraphHorizontalBarWeighted.renderSubplot2  sñ  € ØŒ;ÐÝÐ[Ñ\Ô\Ð\ØŒ{Ð&Ð&Ð&ØŒ9ÐÝð Fñ Gô Gð GàŒyÐ$Ð$Ð$àŒ×#Ò#¨Ð#Ñ.Ô.Ð.àˆØˆØˆð ˆØˆå˜œ‘O”OˆŒ	ØŒ	×ÒÑÔÐØœ9ð <	ñ <	‰KˆC�Ø�KŠK˜ÑÔÐØˆGØˆGØˆFØˆFÝ$ VÑ,Ô,ð '/ñ '/‘��4Ø�Ø�Ø �ØŸšÑ(Ô(�Øœ
�Ø�å�t‘9”9 ’>�>Ø,0Ñ)�A�t˜\˜\Ý˜‘Y”Y !’^�^Ø37Ñ0�A�t˜\¨5¨5Ý˜‘Y”Y !’^�^Ø:>Ñ7�A�t˜\¨5°%°%Ý˜‘Y”Y !’^�^ØBFÑ?�A�t˜\¨5°%¸å  ™œ�Ø�<Ý$ð &RØKOð&Rð &Rñ Sô Sð SàÐ'Ð'Ð'à—’  4˜yÑ)Ô)Ð)Ø—’˜eÑ$Ô$Ð$Ø—’˜eÑ$Ô$Ð$à˜GÐ#Ð#Ø—N’N 1Ñ%Ô%Ð%Ø˜‘H WÐ,Ð,Ø—N’N 1 t¡8Ñ,Ô,Ð,ð
 ”N \Ñ1�Øœ>¨AÑ-°Ñ4�Ø!œ^¨q°<Ñ/?Ñ@À3ÑF�
Ø  4¤;Ñ.°Ñ8¸JÈÑ<OÑP�	Ø—’ 	¨1˜~Ñ.Ô.Ð.Ñ.å& wÑ/Ô/ð 9ð 9‘	��6ð ×#Ò# V HØ$+¨A¤JØ/5°a¬yØ*0°¬)Ø.4°Q¬ið	 $ñ 9ô 9ð 9ð 9ð �MŠM˜4 $¤-°#Ñ"5Ñ5°sÐ;Ñ<Ô<Ð<à�D”MÑ!ˆDØ�‰FˆA‰Aå�7‰|Œ|ˆÝ�7‰|Œ|ˆð
 	×Ò˜# ¥3 t¡9¤9¨t¬}Ñ#<Ð=ÈtÐÑTÔTÐTØ×Ò˜#  d˜|¸TÐÑBÔBÐBØ�Š�c˜6Ñ"Ô"Ð"Ð"Ð"rL   rõ   rö   r~  r,  s   @rJ   r€  r€    sÞ   ø€ € € € € € ðð ð IØ4ð!ð !€Ið ð ð ñ ð
 (€IØÐà,1Ô,Fð Jñ -Ðð ð ð ñ ð
ð ð ð ð ð ð$ ð1ð 1ñ „Xð1ð[#ð [#ð [#ð [#ð [#ð [#ð [#ð [#rL   r€  c                  ó~   ‡ — e Zd ZU dZdddœZded<   dZdZej	        dz   Z	d	ed
<   dˆ fd„Z
ed„ ¦   «         Zdd„Zˆ xZS )ÚGraphScatterWeighteda  
    A scatter plot where points are scaled in size to
    represent the number of values stored within.

    >>> g = graph.primitives.GraphScatterWeighted()
    >>> g.doneAction = None #_DOCS_HIDE
    >>> data = [(23, 15, 234), (10, 23, 12), (4, 23, 5), (15, 18, 120)]
    >>> g.data = data
    >>> g.process()

    .. image:: images/GraphScatterWeighted.*
        :width: 600

    z1the maximum diameter of any ellipse, default 1.25z1the minimum diameter of any ellipse, default 0.25©ÚmaxDiameterÚminDiameterr  r  ÚscatterWeighted)r0  r0  r   r+   r,   r-   c                óp   •— d| _         d| _         t          ¦   «         j        di |¤Ž d|vr	d| _        d S d S )Ng      ô?rƒ  r   rU  rä   )r–  r—  r  rK   r   r	  s     €rJ   rK   zGraphScatterWeighted.__init__¶  sN   ø€ Ø"&ˆÔØ"&ˆÔà�‰ŒÔÐ$Ð$˜8Ð$Ð$Ð$à˜(Ð"Ð"ØˆDŒJˆJˆJð #Ð"rL   c                ó    — | j         | j        z
  S rY   r•  rP   s    rJ   ÚrangeDiameterz"GraphScatterWeighted.rangeDiameter¿  s   € àÔ $Ô"2Ñ2Ð2rL   r<   rŒ   c           
     ó„  — | j         €t          d¦  «        ‚| j         €J ‚| j        €t          d¦  «        ‚| j        €J ‚t          ¦   «         }|j        }| j                              dd¬¦  «         d„ | j        D ¦   «         }d„ | j        D ¦   «         }d„ | j        D ¦   «         }g }| j        D ]5}t          |¦  «        dk    r	|d         }	ni }	|                     |	¦  «         Œ6t          |¦  «        }
t          |¦  «        }t          |
|z
  ¦  «        }t          |¦  «        }t          |¦  «        }t          ||z
  ¦  «        }t          |¦  «        }t          |¦  «        }t          ||z
  ¦  «        }d	}d	}||k    r||z  }n||k    r||z  }g }|D ]Z}|d
k    r|                     d
d
g¦  «         Œ |d
k    r	||z
  |z  }nd}| j        | j        |z  z   }|                     ||g¦  «         Œ[t          t          | j        ¦  «        ¦  «        D �]}||         }||         }||         \  }}||         }	||z  }||z  } |j        d||f||dœ|	¤Ž}|                     |¦  «         |                     |j        ¦  «         |                     | j        ¦  «         |                     |                      ¦   «         ¦  «         ||         dk    rB||dz  d|z  z   z   } |dz   }!|                     | |!t/          ||         ¦  «        dddd¬¦  «         �Œ|                      d||f¦  «         |                      d||
f¦  «         d S )Nr  r  r  r�   c                ó   — g | ]
}|d          ‘ŒS )r   rä   ©rB  Úds     rJ   rC  z6GraphScatterWeighted.renderSubplot.<locals>.<listcomp>Ò  ó   € Ð)Ð)Ð)˜!��1”Ð)Ð)Ð)rL   c                ó   — g | ]
}|d          ‘ŒS r@  rä   rž  s     rJ   rC  z6GraphScatterWeighted.renderSubplot.<locals>.<listcomp>Ó  r   rL   c                ó   — g | ]
}|d          ‘ŒS )rw   rä   rž  s     rJ   rC  z6GraphScatterWeighted.renderSubplot.<locals>.<listcomp>Ô  r   rL   rÆ   r>  r   r  )ÚxyrH  Úheightrc   r†  r~   r   Úbaseliner�   )ÚsizeÚvaÚhaÚmultialignmentr   r   rä   )r;   r˜   r:   r   Úpatchesr  rd   rk   rx   rf  r‚   r—  r›  r/   ÚEllipseÚ
add_artistÚset_clip_boxÚbboxr  r   r«   rf   Útextra   r‡   )"rD   r<   rF   rª  ÚxListÚyListÚzListÚformatDictListrŸ  Ú
formatDictr{  rz  r|  ÚyMaxÚyMinrv  ÚzMaxÚzMinÚzRangeÚxDistortÚyDistortÚzNormrÃ   ÚscalarÚscaledrŸ   r   r   Úunused_zScalarrH  r¤  ÚeÚ	adjustedXr’  s"                                     rJ   rß   z"GraphScatterWeighted.renderSubplotÃ  sÂ  € ØŒ;ÐÝÐ[Ñ\Ô\Ð\ØŒ{Ð&Ð&Ð&ØŒ9ÐÝð Fñ Gô Gð GàŒyÐ$Ð$Ð$Ý!Ñ#Ô#ˆØ”,ˆð 	Œ×#Ò#¨°dÐ#Ñ;Ô;Ð;ð *Ð)˜tœyÐ)Ñ)Ô)ˆØ)Ð)˜tœyÐ)Ñ)Ô)ˆØ)Ð)˜tœyÐ)Ñ)Ô)ˆØˆØ”ð 	.ð 	.ˆAÝ�1‰vŒv˜ŠzˆzØ˜qœT�
�
à�
Ø×!Ò! *Ñ-Ô-Ð-Ð-å�5‰zŒzˆÝ�5‰zŒzˆÝ�t˜d‘{Ñ#Ô#ˆå�5‰zŒzˆÝ�5‰zŒzˆÝ�t˜d‘{Ñ#Ô#ˆå�5‰zŒzˆÝ�5‰zŒzˆÝ�t˜d‘{Ñ#Ô#ˆð
 ˆØˆØ�FŠ?ˆ?Ø ‘ˆHˆHØ�fŠ_ˆ_Ø ‘ˆHð ˆØð 
	/ð 
	/ˆAØ�AŠvˆvØ—’˜a ˜VÑ$Ô$Ð$Ð$ð ˜Q’;�;Ø $™h¨&Ñ0�F�Fà �FØÔ)¨TÔ-?À&Ñ-HÑI�Ø—’˜f fÐ-Ñ.Ô.Ð.Ð.õ •s˜4œ9‘~”~Ñ&Ô&ð "	4ñ "	4ˆAØ�a”ˆAØ�a”ˆAØ % a¤ÑˆAˆ~Ø'¨Ô*ˆJà˜‘LˆEØ˜‘\ˆFØ�”ÐT A q 6°¸vÐTÐTÈÐTÐTˆAà×Ò˜qÑ!Ô!Ð!à�NŠN˜7œ<Ñ(Ô(Ð(à�KŠK˜œ
Ñ#Ô#Ð#Ø�OŠO˜DŸNšNÑ,Ô,Ñ-Ô-Ð-ð
 �QŒx˜!Š|ˆ|ð
  %¨#¡+°$¸±/Ñ!BÑC�	Ø ™H�	à—’˜YØ&Ý   q¤™]œ]Ø"#Ø *Ø &Ø,2ð ñ 4ô 4ð 4ùð 	×Ò˜#  d˜|Ñ,Ô,Ð,Ø×Ò˜#  d˜|Ñ,Ô,Ð,Ð,Ð,rL   rõ   rö   )r÷   rø   rù   rú   r  rü   rû   r   r   r+   rK   rý   r›  rß   r+  r,  s   @rJ   r”  r”  œ  sÞ   ø€ € € € € € ðð ð KØJð!ð !€Ið ð ð ñ ð
 "€IØÐà,1Ô,Fð J&ñ -&Ðð &ð &ð &ñ &ðð ð ð ð ð ð ð3ð 3ñ „Xð3ðd-ð d-ð d-ð d-ð d-ð d-ð d-ð d-rL   r”  c                  ó   — e Zd ZdZdZd	d„ZdS )
ÚGraphScatteraP  
    Graph two parameters in a scatter plot.
    Data representation is a list of points of values.

    >>> g = graph.primitives.GraphScatter()
    >>> g.doneAction = None #_DOCS_HIDE
    >>> data = [(x, x * x) for x in range(50)]
    >>> g.data = data
    >>> g.process()

    .. image:: images/GraphScatter.*
        :width: 600
    Úscatterr<   rŒ   r,   r-   c           	     ó¸  — | j         €t          d¦  «        ‚| j         €J ‚| j        €t          d¦  «        ‚| j        €J ‚| j                              d¬¦  «         g }g }d}| j        D ]ò}t	          |¦  «        dk     rt          d¦  «        ‚|d         }|d         }|                     |¦  «         |                     |¦  «         | j        }|                      ¦   «         }	| j	        }
| j
        }t	          |¦  «        d	k    r8|d         }d
|v r|d
         }	d|v r|d         }d|v r|d         }
d|v r|d         }|                     ||||	|
|¬¦  «         |dz  }Œó| j        d         s2|                      dt          |¦  «        t          |¦  «        f¦  «         | j        d         s4|                      dt          |¦  «        t          |¦  «        f¦  «         d S d S )Nr  r  r  r  r   rw   z1Need at least two points for a graph data object!rc   rÆ   r»   r"   r   r#   )r"   r»   r   r#   r   r   )r;   r˜   r:   r  rd   r   rk   r"   rf   r   r#   Úplotr?   r‡   rf  rx   )rD   r<   ÚxValuesÚyValuesrŸ   Úrowr   r   r"   r»   r   r#   ÚdisplayDatas                rJ   rß   zGraphScatter.renderSubplot:  s!  € ØŒ;ÐÝÐ[Ñ\Ô\Ð\ØŒ{Ð&Ð&Ð&ØŒ9ÐÝð Fñ Gô Gð GàŒyÐ$Ð$Ð$ØŒ×#Ò#¨Ð#Ñ.Ô.Ð.ØˆØˆØˆà”9ð 	ð 	ˆCÝ�3‰xŒx˜!Š|ˆ|Ý$Ð%XÑYÔYÐYØ�A”ˆAØ�A”ˆAØ�NŠN˜1ÑÔÐØ�NŠN˜1ÑÔÐØ”[ˆFØ—N’NÑ$Ô$ˆEØ”JˆEØœˆJÝ�3‰xŒx˜1Š}ˆ}Ø! !œf�Ø˜kÐ)Ð)Ø'¨Ô0�EØ˜{Ð*Ð*Ø(¨Ô2�FØ˜kÐ)Ð)Ø'¨Ô0�EØ ;Ð.Ð.Ø!,¨\Ô!:�Jà�LŠL˜˜A f°EÀÐS]ˆLÑ^Ô^Ð^Ø�‰FˆAˆAàÔ'¨Ô,ð 	AØ×Ò˜c¥C¨¡L¤Lµ#°g±,´,Ð#?Ñ@Ô@Ð@àÔ'¨Ô,ð 	AØ×Ò˜c¥C¨¡L¤Lµ#°g±,´,Ð#?Ñ@Ô@Ð@Ð@Ð@ð	Að 	ArL   Nrö   )r÷   rø   rù   rú   rû   rß   rä   rL   rJ   rÃ  rÃ  *  s?   € € € € € ðð ð €Ið*Að *Að *Að *Að *Að *ArL   rÃ  c                  ój   ‡ — e Zd ZU dZddiZded<   dZej        dz   Zded	<   d
d
dœdˆ fd„Z	dd„Z
ˆ xZS )ÚGraphHistogramaþ  
    Graph the count of a single element.

    Data set is simply a list of x and y pairs, where there
    is only one of each x value, and y value is the count or magnitude
    of that value

    >>> import random
    >>> g = graph.primitives.GraphHistogram()
    >>> g.doneAction = None #_DOCS_HIDE
    >>> g.graphType
    'histogram'

    >>> data = [(x, random.choice(range(30))) for x in range(50)]
    >>> g.data = data
    >>> g.process()

    .. image:: images/GraphHistogram.*
        :width: 600
    ÚbinWidthzÁ
            Size of each bin; if the bins are equally spaced at intervals of 1,
            then 0.8 is a good default to allow a little space. 1.0 will give no
            space.
            r  r  Ú	histogram)rÍ  r   r+   çš™™™™™é?)rÍ  r   r‚   r   c               óL   •— || _          t          ¦   «         j        dd|i|¤Ž d S )Nr   rä   )rÍ  r  rK   )rD   rÍ  r   rE   r
  s       €rJ   rK   zGraphHistogram.__init__‡  s2   ø€ Ø ˆŒØ�‰ŒÔÐ1Ð1˜uÐ1¨Ð1Ð1Ð1Ð1Ð1rL   r<   rŒ   r,   r-   c                óê  — | j         €t          d¦  «        ‚| j         €J ‚| j        €t          d¦  «        ‚| j        €J ‚| j                              d¬¦  «         g }g }| j        }t          | j        d         ¦  «        }| j        }| j        D ]K}t          |¦  «        dk    r|\  }}	}
n|\  }}	| 	                    |¦  «         | 	                    |	¦  «         ŒL| 
                    |||||¬¦  «         d S )Nr  r  r  r  r   rw   ©rH  r   r»   )r;   r˜   r:   r  rÍ  r	   r   r   rd   rk   r  )rD   r<   r   r   rÍ  r»   r   ÚpointÚaÚbÚunused_formatDicts              rJ   rß   zGraphHistogram.renderSubplot‹  s  € ØŒ;ÐÝÐ[Ñ\Ô\Ð\ØŒ{Ð&Ð&Ð&ØŒ9ÐÝð Fñ Gô Gð GàŒyÐ$Ð$Ð$ØŒ×#Ò#¨Ð#Ñ.Ô.Ð.àˆØˆØ”=ˆÝ˜œ QœÑ(Ô(ˆØ”
ˆà”Yð 	ð 	ˆEÝ�5‰zŒz˜AŠ~ˆ~Ø*/Ñ'��1Ð'Ð'à‘��1Ø�HŠH�Q‰KŒKˆKØ�HŠH�Q‰KŒKˆKˆKà�Š�A�q °¸UˆÑCÔCÐCÐCÐCrL   )rÍ  r‚   r   r‚   rö   )r÷   rø   rù   rú   r  rü   rû   r   r+   rK   rß   r+  r,  s   @rJ   rÌ  rÌ  g  sº   ø€ € € € € € ðð ð* 	ð ð!€Ið ð ð ñ ð €IØ,1Ô,FÈÑ,VÐÐVÐVÐVÑVà,/Àð 2ð 2ð 2ð 2ð 2ð 2ð 2ð 2ðDð Dð Dð Dð Dð Dð Dð DrL   rÌ  c                  óX   ‡ — e Zd ZU dZdZej        dz   Zded<   dˆ fd„Zdd„Z	dd„Z
ˆ xZS )ÚGraphGroupedVerticalBara¹  
    Graph the count of one or more elements in vertical bars.

    The `.data` is simply a list of x and y pairs, where there
    is only one of each x value, and y value is a list of values.

    >>> from collections import OrderedDict
    >>> g = graph.primitives.GraphGroupedVerticalBar()
    >>> g.doneAction = None #_DOCS_HIDE
    >>> lengths = OrderedDict( [('a', 3), ('b', 2), ('c', 1)] )
    >>> data = [('bar' + str(x), lengths) for x in range(3)]
    >>> data
    [('bar0', OrderedDict([('a', 3), ('b', 2), ('c', 1)])),
     ('bar1', OrderedDict([('a', 3), ('b', 2), ('c', 1)])),
     ('bar2', OrderedDict([('a', 3), ('b', 2), ('c', 1)]))]
    >>> g.data = data
    >>> g.process()
    ÚgroupedVerticalBar)rÍ  ÚroundDigitsÚgroupLabelHeightr   r+   r,   r-   c                ód   •— d| _         d| _        d| _         t          ¦   «         j        di |¤Ž d S )Nrc   rb  rä   )rÍ  rÚ  rÛ  r  rK   r	  s     €rJ   rK   z GraphGroupedVerticalBar.__init__½  s=   ø€ Ø%&ˆŒØ !ˆÔØ'*ˆÔà�‰ŒÔÐ$Ð$˜8Ð$Ð$Ð$Ð$Ð$rL   r<   rŒ   c                ó  — |D ]ˆ}|                      ¦   «         |                     ¦   «         dz  z   }|                     ¦   «         }|                     ||t	          t          || j        ¦  «        ¦  «        dd| j        | j        ¬¦  «         Œ‰d S )Nrw   r7   r‘   )r¨  r§  r¤   r¥   )	Úget_xÚ	get_widthÚ
get_heightr¯  ra   ry   rÚ  r%   r   )rD   r<   Úrectsrµ   rÁ  r¤  s         rJ   Ú	labelBarsz!GraphGroupedVerticalBar.labelBarsÄ  s™   € àð 		1ð 		1ˆDØŸ
š
™œ¨¯ªÑ(8Ô(8¸1Ñ(<Ñ=ˆIØ—_’_Ñ&Ô&ˆFØ�LŠL˜ØÝ�U 6¨4Ô+;Ñ<Ô<Ñ=Ô=Ø$Ø$Ø"&Ô"3Ø $¤ð ñ 1ô 1ð 1ð 1ð		1ð 		1rL   c           	     ó@  ‡— | j         €t          d¦  «        ‚| j         €J ‚t          ¦   «         }|j        }d}g }| j         D ]5\  }Št	          ‰¦  «        }t          ‰                     ¦   «         ¦  «        } | j        }||z  }g }	g }
t          | j         ¦  «        D ]]\  }\  }Š|	 	                    |¦  «         |
 	                    ˆfd„t          ‰                     ¦   «         ¦  «        D ¦   «         ¦  «         Œ^g }t          |¦  «        D ]�}g }t          |	¦  «        D ]&\  }}| 	                    |
|         |         ¦  «         Œ'g }|	D ]}| 	                    |||z  z   ¦  «         Œ|                     |||d|                      ¦   «         ¬¦  «        }| 	                    |¦  «         Œžg }|D ]3}|                      ||¦  «         | 	                    |d         ¦  «         Œ4|j                             | j        | j        ¬¦  «        }|                     |||¬¦  «         d S )	Nr  rc   c                ó    •— g | ]
}‰|         ‘ŒS rä   rä   )rB  rp  rÕ  s     €rJ   rC  z9GraphGroupedVerticalBar.renderSubplot.<locals>.<listcomp>ë  s   ø€ Ð@Ð@Ð@¨˜Q˜sœVÐ@Ð@Ð@rL   rÏ  rÒ  r   )r¦  r¥   )Úprop)r:   r˜   r   Ú
matplotlibrd   Úsortedrn  rÍ  r™   rk   r/   r  rf   râ  Úfont_managerÚFontPropertiesr%   r   Úlegend)rD   r<   rF   ræ  ÚbarsPerGroupÚ	subLabelsÚunused_arÍ  Ú
widthShiftÚxValsÚyBundlesrŸ   rá  ÚyValsr'  Ú_xÚxValsShiftedr   rµ   r   Ú	fontPropsrÕ  s                        @rJ   rß   z%GraphGroupedVerticalBar.renderSubplotÑ  sn  ø€ ØŒ9ÐÝð Fñ Gô Gð GàŒyÐ$Ð$Ð$Ý!Ñ#Ô#ˆØ”_ˆ
àˆØˆ	ð  œ9ð 	ð 	‰KˆH�aÝ˜q™6œ6ˆLå˜qŸvšv™xœxÑ(Ô(ˆIØà”=ˆØ Ñ,ˆ
àˆØˆÝ )¨$¬)Ñ 4Ô 4ð 	Bð 	BÑˆA‰}�˜!à�LŠL˜‰OŒOˆOØ�OŠOÐ@Ð@Ð@Ð@­v°a·f²f±h´hÑ/?Ô/?Ð@Ñ@Ô@ÑAÔAÐAÐAàˆÝ�|Ñ$Ô$ð 	ð 	ˆAØˆEÝ" 5Ñ)Ô)ð -ð -‘��2à—’˜X aœ[¨œ^Ñ,Ô,Ð,Ð,ØˆLàð :ð :�Ø×#Ò# A¨°a©Ñ$8Ñ9Ô9Ð9Ð9à—;’;˜|Ø$Ø%/Ø%(Ø%)§^¢^Ñ%5Ô%5ð	 ñ 7ô 7ˆDð
 �LŠL˜ÑÔÐÐàˆØð 	#ð 	#ˆDØ�NŠN˜7 DÑ)Ô)Ð)Ø�MŠM˜$˜qœ'Ñ"Ô"Ð"Ð"àÔ+×:Ò:ÀÔ@QØBFÄ/ð ;ñ Sô Sˆ	à�Š�v˜y¨yˆÑ9Ô9Ð9Ð9Ð9rL   rõ   rö   )r÷   rø   rù   rú   rû   r   r+   rü   rK   râ  rß   r+  r,  s   @rJ   rØ  rØ  ¦  s    ø€ € € € € € ðð ð$ %€IØ,1Ô,Fð J8ñ -8Ðð 8ð 8ð 8ñ 8ð%ð %ð %ð %ð %ð %ð1ð 1ð 1ð 1ð5:ð 5:ð 5:ð 5:ð 5:ð 5:ð 5:ð 5:rL   rØ  c                  óF   ‡ — e Zd ZdZdZdZddddœdˆ fd„Zdd„Zdd„Zˆ xZ	S )ÚGraph3DBarsa  
    Graph multiple parallel bar graphs in 3D.

    Data definition:
    A list of lists where the inner list of
    (x, y, z) coordinates.

    For instance, a graph where the x values increase
    (left to right), the y values increase in a step
    pattern (front to back), and the z values decrease
    (top to bottom):

    >>> g = graph.primitives.Graph3DBars()
    >>> g.doneAction = None #_DOCS_HIDE
    >>> data = []
    >>> for i in range(1, 10 + 1):
    ...    q = [i, i//2, 10 - i]
    ...    data.append(q)
    >>> g.data = data
    >>> g.process()

    When creating the graph these keyword arguments can be used (in addition to any
    such as `colors` that all Graph classes can use).

    * ``alpha`` -- opacity of each bar, from 0.0 (transparent) to 1.0 (opaque).
      Defaults to 0.8.
    * ``barWidth`` -- width of each bar along the x-axis.  When ``None``
      (default) the width is computed automatically.
      Individual data points may also override this
      via a ``'barWidth'`` key in their per-point format dict.
    * ``barDepth`` -- depth of each bar along the y-axis.  When ``None``
      (default) the depth is computed automatically.
      Individual data points may also override this
      via a ``'barDepth'`` key in their per-point format dict.
    Ú3DBarsrÂ   rÏ  N)r   ÚbarWidthÚbarDepthr   r‚   rø  úfloat | int | Nonerù  c               óx   •—  t          ¦   «         j        dd|i|¤Ž || _        || _        d|vrg d¢| _        d S d S )Nr   r   )z#ff0000z#00ff00z#6666ffrä   )r  rK   rø  rù  r   )rD   r   rø  rù  rE   r
  s        €rJ   rK   zGraph3DBars.__init__0  sY   ø€ ð 	�‰ŒÔÐ1Ð1˜uÐ1¨Ð1Ð1Ð1Ø(0ˆŒØ(0ˆŒØ˜8Ð#Ð#Ø;Ð;Ð;ˆDŒKˆKˆKð $Ð#rL   r,   r-   c                ó8  — t          ¦   «         }|j        }|                     ¦   «         | _        | j                             dddd¬¦  «        | _        |                      | j        ¦  «         |                      | j        ¦  «         |                      ¦   «          d S )Nrc   rÇ   )Ú
projection)r   r9   r;   rÞ   r<   rß   r·   rà   rá   s      rJ   râ   zGraph3DBars.process<  s‡   € Ý!Ñ#Ô#ˆØŒhˆà—j’j‘l”lˆŒØ”{×.Ò.¨q°!°QÀ4Ð.ÑHÔHˆŒà×Ò˜4œ<Ñ(Ô(Ð(à×Ò˜Tœ\Ñ*Ô*Ð*Ø×ÒÑÔÐÐÐrL   r<   rŒ   c                óú  — | j         €t          d¦  «        ‚| j         €J ‚g }g }g }| j         D ]Y}|d         |d         |d         }}}|                     |¦  «         |                     |¦  «         |                     |¦  «         ŒZt          |¦  «        t	          |¦  «        }
}	t          |¦  «        t	          |¦  «        }}t          |¦  «        t	          |¦  «        }}| j        d         d         €|	|
f| j        d         d<   | j        d         d         €||f| j        d         d<   | j        d         d         €||f| j        d         d<   | j        �| j        n|
|	z
  d	z  }| j        �| j        n||z
  d	z  }| j         D ]¯}t          |¦  «        d
k    r	|\  }}}i }n*t          |¦  «        dk    r|\  }}}}nt          d¦  «        ‚d|v r	|d         }n|  
                    ¦   «         }d|v r|d         }d|v r|d         }|                     ||dz  z
  ||dz  z
  d||||| j        ¬¦  «         Œ°|                      ddd¬¦  «         |                      ddd¬¦  «         |                      ddd¬¦  «         d S )Nr  r   rc   rw   r   r/   rÃ   r   é   rÆ   rS  z/Cannot plot a point unless it has 3 or 4 valuesr»   rø  rù  )r»   r   T)rˆ   )r:   r˜   rk   rf  rx   r=   rø  rù  rd   r   rf   Úbar3dr   r‹   )rD   r<   rï  rñ  ÚzValsrÓ  r   r   rÃ   rz  r{  r¶  rµ  r¸  r·  rø  rù  Ú	dataPointr´  r»   s                       rJ   rß   zGraph3DBars.renderSubplotH  sÕ  € ØŒ9ÐÝð Fñ Gô Gð GàŒyÐ$Ð$Ð$ØˆØˆØˆØ”Yð 	ð 	ˆEØ˜A”h  a¤¨%°¬(�!ˆqˆAØ�LŠL˜‰OŒOˆOØ�LŠL˜‰OŒOˆOØ�LŠL˜‰OŒOˆOˆOå˜‘Z”Z¥ U¡¤ˆdˆÝ˜‘Z”Z¥ U¡¤ˆdˆÝ˜‘Z”Z¥ U¡¤ˆdˆàŒ9�SŒ>˜'Ô"Ð*Ø&*¨D jˆDŒI�cŒN˜7Ñ#àŒ9�SŒ>˜'Ô"Ð*Ø&*¨D jˆDŒI�cŒN˜7Ñ#ØŒ9�SŒ>˜'Ô"Ð*Ø&*¨D jˆDŒI�cŒN˜7Ñ#à$(¤MÐ$=�4”=�=ÀDÈ4ÁKÐSUÑCUˆØ$(¤MÐ$=�4”=�=ÀDÈ4ÁKÐSUÑCUˆàœð 	,ð 	,ˆIÝ�9‰~Œ~ Ò"Ð"Ø#‘��1�aØ�
�
Ý�Y‘” 1Ò$Ð$Ø&/Ñ#��1�a˜˜å$Ð%VÑWÔWÐWà˜*Ð$Ð$Ø" 7Ô+��àŸšÑ(Ô(�à˜ZÐ'Ð'Ø% jÔ1�Ø˜ZÐ'Ð'Ø% jÔ1�à�MŠM˜!˜x¨!™|Ñ,¨a°8¸a±<Ñ.@À!Ø" H¨aØ %Ø $¤
ð ñ ,ô ,ð ,ð ,ð
 	×Ò˜#˜s°ÐÑ5Ô5Ð5Ø×Ò˜#˜s°ÐÑ5Ô5Ð5Ø×Ò˜#˜s°ÐÑ5Ô5Ð5Ð5Ð5rL   )r   r‚   rø  rú  rù  rú  rõ   rö   )
r÷   rø   rù   rú   rû   r   rK   râ   rß   r+  r,  s   @rJ   rö  rö  	  s‘   ø€ € € € € ð"ð "ðF €IØ€Hð !$Ø,0Ø,0ð	
<ð 
<ð 
<ð 
<ð 
<ð 
<ð 
<ð 
<ð
ð 
ð 
ð 
ð76ð 76ð 76ð 76ð 76ð 76ð 76ð 76rL   rö  c                  ó   — e Zd Zd„ ZdS )ÚTestc                óB   — ddl m}  || t          ¦   «         ¦  «         d S )Nr   )ÚtestCopyAll)Úmusic21.test.commonTestr  Úglobals)rD   r  s     rJ   ÚtestCopyAndDeepcopyzTest.testCopyAndDeepcopy„  s0   € Ø7Ð7Ð7Ð7Ð7Ð7Øˆ�D�'™)œ)Ñ$Ô$Ð$Ð$Ð$rL   N)r÷   rø   rù   r	  rä   rL   rJ   r  r  ‚  s#   € € € € € ð%ð %ð %ð %ð %rL   r  c                  óD   — e Zd ZdZd„ Zd„ Zd„ Zd„ Zd„ Zd„ Z	dd	„Z
d
„ ZdS )ÚTestExternalTc                ó
  ‡— t          d dd¬¦  «        }d„ t          d¦  «        D ¦   «         }||_        |                     ¦   «          t	          d d¬¦  «        }d„ t          d¦  «        D ¦   «         }||_        |                     ¦   «          t          d d	d
ddg¬¦  «        }g }t          dd¦  «        D ]2Šˆfd„t          d¦  «        D ¦   «         }|                     |¦  «         Œ3||_        |                     ¦   «          ~d S )Nzx to x*xrc   )r   r&   r   c                ó   — g | ]	}|||z  f‘Œ
S rä   rä   rA  s     rJ   rC  z*TestExternal.testBasic.<locals>.<listcomp>Ž  ó    € Ð.Ð.Ð.˜q��A˜‘E�
Ð.Ð.Ð.rL   é2   z50 x with random(30) y counts)r   r&   c                óT   — g | ]%}|t          j        t          d ¦  «        ¦  «        f‘Œ&S ©é   ©ÚrandomÚchoicer/   rA  s     rJ   rC  z*TestExternal.testBasic.<locals>.<listcomp>“  ó-   € ÐAÐAÐA°!�•F”M¥%¨¡)¤)Ñ,Ô,Ð-ÐAÐAÐArL   z,50 x with random values increase by 10 per xrÏ  rÕ  Úg)r   r&   r   r   rS  c                ól   •— g | ]0}|t          j        t          d ‰z  d ‰dz   z  ¦  «        ¦  «        ‰f‘Œ1S ©r5   rc   r  ©rB  r   rŸ   s     €rJ   rC  z*TestExternal.testBasic.<locals>.<listcomp>�  s@   ø€ ÐWÐWÐWÈ�!•V”]¥5¨¨a©°°q¸1±u±Ñ#>Ô#>Ñ?Ô?ÀÐCÐWÐWÐWrL   )rÃ  r/   r:   râ   rÌ  rö  Úextend)rD   rÔ  r:   ÚqrŸ   s       @rJ   Ú	testBasiczTestExternal.testBasicŒ  s  ø€ Ý D°
À!ÐDÑDÔDˆØ.Ð.¥E¨"¡I¤IÐ.Ñ.Ô.ˆØˆŒØ	�	Š	‰Œˆå dÐ2QÐRÑRÔRˆØAÐAµu¸R±y´yÐAÑAÔAˆØˆŒØ	�	Š	‰Œˆå 4ØLØ!Ø # S˜zð+ñ +ô +ˆð ˆÝ�q˜!‘”ð 	ð 	ˆAØWÐWÐWÐWÍUÐSUÉYÌYÐWÑWÔWˆAØ�KŠK˜‰NŒNˆNˆNØˆŒØ	�	Š	‰ŒˆàˆAˆArL   c                óx  — g }dD ]‰}g }t          d¦  «        D ]^}t          j        t          d¦  «        ¦  «        }|t          j        t          d¦  «        ¦  «        z   }|                     ||f¦  «         Œ_|                     ||g¦  «         ŒŠt	          d ¬¦  «        }||_        |                     ¦   «          d S )N)
rÔ  rÕ  re   rŸ  rÀ  Úfr  r�  rŸ   r'  r5   é–   r  ©r   )r/   r  r  rk   rL  r:   râ   )rD   r:   ro   rq  rŸ   ÚstartÚendrÔ  s           rJ   ÚtestBrokenHorizontalz!TestExternal.testBrokenHorizontal¤  s¹   € ØˆØGð 	)ð 	)ˆEØˆFÝ˜2‘Y”Yð ,ð ,�Ýœ¥e¨C¡j¤jÑ1Ô1�Ø�fœm­E°"©I¬IÑ6Ô6Ñ6�Ø—’˜u c˜lÑ+Ô+Ð+Ð+Ø�KŠK˜ ˜Ñ(Ô(Ð(Ð(å¨$Ð/Ñ/Ô/ˆØˆŒØ	�	Š	‰ŒˆˆˆrL   c                ó”  — g }t          d¦  «        D ]~}t          j        t          d¦  «        ¦  «        }t          j        t          d¦  «        ¦  «        }t          j        t          dd¦  «        ¦  «        }|                     |||g¦  «         Œ| j        rd}nd }t          |¬¦  «        }||_        |                     ¦   «          d S )Nr  rÿ  rc   r8   r!  )r/   r  r  rk   r`   r”  r:   râ   )rD   r:   rŸ   r   r   rÃ   r   rÔ  s           rJ   ÚtestScatterWeightedz TestExternal.testScatterWeighted²  s¶   € ØˆÝ�r‘”ð 	#ð 	#ˆAÝ”�e B™iœiÑ(Ô(ˆAÝ”�e B™iœiÑ(Ô(ˆAÝ”�e A r™lœlÑ+Ô+ˆAØ�KŠK˜˜A˜q˜	Ñ"Ô"Ð"Ð"àŒ9ð 	Ø ˆJˆJàˆJÝ ¨JÐ7Ñ7Ô7ˆØˆŒØ	�	Š	‰ŒˆˆˆrL   c                óÖ  ‡	— g }t          dd¦  «        D ]2Š	ˆ	fd„t          d¦  «        D ¦   «         }|                     |¦  «         Œ3t          ddgfddd	gfd
dgfgft          g d¢ft          d„ t          d¦  «        D ¦   «         ft
          d„ t          d¦  «        D ¦   «         ft          |ft          dg d¢fdg d¢fgft          g d¢ddgg d¢gfg}|D ]•\  }} |d¬¦  «        }||_	        | 
                    ¦   «          |j        j        dz   }t          t                               ¦   «         |z  ¦  «        }t                               d|g¦  «         |                     |¦  «         Œ–dS )zŸ
        Write a graphic file for all graphs,
        naming them after the appropriate class.
        This is used to generate documentation samples.
        rc   rS  c           
     ód   •— g | ],}|t          j        t          d ‰dz   z  ¦  «        ¦  «        ‰f‘Œ-S r  r  r  s     €rJ   rC  z6TestExternal.x_test_writeAllGraphs.<locals>.<listcomp>Ì  ó:   ø€ ÐOÐOÐOÀ�!•V”]¥5¨¨q°1©u©Ñ#6Ô#6Ñ7Ô7¸Ð;ÐOÐOÐOrL   rÿ  ÚChopin)é  é'   Ú	Schumanns)r+  é.   )i  éM   ÚBrahms)i)  é@   ))é   é   éê   )r5   r2  r4   )rS  r2  r0  )r3  é   éx   c                ó   — g | ]	}|||z  f‘Œ
S rä   rä   rA  s     rJ   rC  z6TestExternal.x_test_writeAllGraphs.<locals>.<listcomp>Ú  s    € Ð,Ð,Ð,˜Qˆq�!�a‘%ˆjÐ,Ð,Ð,rL   r  c                óT   — g | ]%}|t          j        t          d ¦  «        ¦  «        f‘Œ&S r  r  rA  s     rJ   rC  z6TestExternal.x_test_writeAllGraphs.<locals>.<listcomp>Ü  s-   € Ð?Ð?Ð?°ˆq•&”-¥ b¡	¤	Ñ*Ô*Ð+Ð?Ð?Ð?rL   ÚMajor))ÚCz#00AA55)ÚDz#5600FF)ÚGz#2B00FFÚMinor))r:  z#004600)r;  z#00009b)r<  z#00009B)z#8968CDz#96CDCDz#CD4F39z#FFD600z#FF5600)z#201a2bz#8f73bfz#a080d5z#6495EDz#FF83FANr!  rë   úwriting fp:)r/   r  rL  r”  rÃ  rÌ  rö  r.  r  r:   râ   r
  r÷   ra   r§   ÚgetRootTempDirr¨   r8   )
rD   Údata3DPolygonBarsr  ÚgraphClassesÚgraphClassNamer:   ÚobjÚfnrå   rŸ   s
            @rJ   Úx_test_writeAllGraphsz"TestExternal.x_test_writeAllGraphsÂ  sã  ø€ ð ÐÝ�q˜!‘”ð 	(ð 	(ˆAØOÐOÐOÐOÅUÈ2ÁYÄYÐOÑOÔOˆAØ×$Ò$ QÑ'Ô'Ð'Ð'õ
  ØÐ-Ð.Ð/ØÐ0Ð2EÐFÐGØÐ-Ð.Ð/ð1ðõ
 "ØEÐEÐEðGåØ,Ð,¥%¨¡)¤)Ð,Ñ,Ô,ð.åØ?Ð?µU¸2±Y´YÐ?Ñ?Ô?ðAåÐ+Ð,Ý!ØÐNÐNÐNÐOØÐNÐNÐNÐOðSðõ Ð?Ð?Ð?Ø(¨)Ð4ØUÐUÐUð ð ð#
ˆð2 %1ð 	ð 	Ñ ˆN˜DØ �.¨DÐ1Ñ1Ô1ˆCØˆCŒHØ�KŠK‰MŒMˆMØ”Ô'¨&Ñ0ˆBÝ•\×0Ò0Ñ2Ô2°RÑ7Ñ8Ô8ˆBÝ×#Ò# ]°BÐ$7Ñ8Ô8Ð8Ø�IŠI�b‰MŒMˆMˆMð	ð 	rL   c                ó  — t          d ¬¦  «        }g d¢g d¢g d¢g d¢g d¢g d¢g}||_        |                     ¦   «          |j        j        dz   }t          t                               ¦   «         |z  ¦  «        }|                     |¦  «         d S )	Nr!  )ú#525252ú#5f5f5fú#797979ú#858585ú#727272ú#6c6c6cú#8c8c8crM  rL  ú#999999rN  rI  rL  rH  rG  z#464646ú#3f3f3frO  ú#4c4c4crP  rI  rI  rP  rP  rG  rH  rI  rJ  rK  rL  )rN  rN  rN  rN  rN  rN  rN  rN  rN  rN  rN  rI  rL  rH  rH  rJ  rI  rI  rI  rI  rI  rI  rJ  ú#929292rN  )rN  rN  rN  rN  rN  rN  rN  rN  rN  rN  rN  rN  rM  rM  rM  rJ  rI  rJ  rQ  rN  )rN  rN  rN  rN  rN  rN  rN  rN  rN  rN  rN  rN  rM  rQ  rN  )
rN  rN  rN  rN  rN  rN  rN  rN  rN  rN  )rN  rN  rN  rN  rN  rë   )	r  r:   râ   r
  r÷   ra   r§   r?  r8   )rD   rÔ  r:   rD  rå   s        rJ   Úx_test_writeGraphColorGridz'TestExternal.x_test_writeGraphColorGridó  sÊ   € å dÐ+Ñ+Ô+ˆðSð Sð Sð
^ð ^ð ^ð'ð 'ð 'ð2ð 2ð 2ð=ð =ð =àGÐGÐGð%Iˆð& ˆŒØ	�	Š	‰ŒˆØŒ[Ô! FÑ*ˆÝ•×,Ò,Ñ.Ô.°Ñ3Ñ4Ô4ˆà	�Š�‰ŒˆˆˆrL   c                óþ  ‡
— g }t          d¬¦  «        }d„ t          d¦  «        D ¦   «         }||_        |                     |dg¦  «         t          ddd¬¦  «        }d	„ t          d¦  «        D ¦   «         }||_        |                     |d
g¦  «         t	          d¬¦  «        }d„ t          d¦  «        D ¦   «         }||_        |                     |dg¦  «         t          d¬¦  «        }g }t          dd¦  «        D ]2Š
ˆ
fd„t          d¦  «        D ¦   «         }|                     |¦  «         Œ3||_        |                     |dg¦  «         t          ddddg d¢¬¦  «        }||_        |                     |dg¦  «         |D ]x\  }}|                     ¦   «          |dz   }t          t           
                    ¦   «         |z  ¦  «        }	t                               d|	g¦  «         |                     |	¦  «         ŒydS )z6
        Write graphing examples for the docs
        Nr!  c                ó   — g | ]	}|||z  f‘Œ
S rä   rä   rA  s     rJ   rC  z9TestExternal.x_test_writeGraphingDocs.<locals>.<listcomp>  r  rL   r  zgraphing-01zExponential Graphrc   )r&   r   r   c                ó   — g | ]	}|||z  f‘Œ
S rä   rä   rA  s     rJ   rC  z9TestExternal.x_test_writeGraphingDocs.<locals>.<listcomp>  r  rL   zgraphing-02c                óT   — g | ]%}|t          j        t          d ¦  «        ¦  «        f‘Œ&S r  r  rA  s     rJ   rC  z9TestExternal.x_test_writeGraphingDocs.<locals>.<listcomp>!  r  rL   zgraphing-03rS  c           
     ód   •— g | ],}|t          j        t          d ‰dz   z  ¦  «        ¦  «        ‰f‘Œ-S r  r  r  s     €rJ   rC  z9TestExternal.x_test_writeGraphingDocs.<locals>.<listcomp>(  r)  rL   rÿ  zgraphing-04zRandom DatarÏ  r0   )rÕ  Úrr  )r&   r   rø  r   r   zgraphing-05rë   r>  )rÃ  r/   r:   rk   rÌ  rö  r  râ   ra   r§   r?  r¨   r8   )rD   ÚpostrÔ  r:   r  rÕ  rC  ÚnamerD  rå   rŸ   s             @rJ   Úx_test_writeGraphingDocsz%TestExternal.x_test_writeGraphingDocs  s  ø€ ð ˆå DÐ)Ñ)Ô)ˆØ.Ð.¥E¨"¡I¤IÐ.Ñ.Ô.ˆØˆŒØ�Š�Q˜Ð&Ñ'Ô'Ð'åÐ2¸!ÈÐMÑMÔMˆØ.Ð.¥E¨"¡I¤IÐ.Ñ.Ô.ˆØˆŒØ�Š�Q˜Ð&Ñ'Ô'Ð'å dÐ+Ñ+Ô+ˆØAÐAµu¸R±y´yÐAÑAÔAˆØˆŒØ�Š�Q˜Ð&Ñ'Ô'Ð'å 4Ð(Ñ(Ô(ˆØˆÝ�q˜!‘”ð 	ð 	ˆAØOÐOÐOÐOÅUÈ2ÁYÄYÐOÑOÔOˆAØ�KŠK˜‰NŒNˆNˆNØˆŒØ�Š�Q˜Ð&Ñ'Ô'Ð'å˜mØ!Ø!$Ø#'Ø.˜˜ð	0ñ 0ô 0ˆð
 ˆŒØ�Š�Q˜Ð&Ñ'Ô'Ð'àð 	ð 	‰IˆC�Ø�KŠK‰MŒMˆMØ˜‘ˆBÝ•\×0Ò0Ñ2Ô2°RÑ7Ñ8Ô8ˆBÝ×#Ò# ]°BÐ$7Ñ8Ô8Ð8Ø�IŠI�b‰MŒMˆMˆMð	ð 	rL   Nc                óº   — ddl m} |                     ¦   «         }|                     ¦   «         }t	          |d¬¦  «        }||_        |                     ¦   «          d S )Nr   )Údiscreterì   )r   r   )Úmusic21.analysisr]  ÚKrumhanslSchmucklerÚsolutionLegendr.  r:   râ   )rD   r   r]  Úksr:   rÔ  s         rJ   ÚtestColorGridLegendz TestExternal.testColorGridLegend<  s`   € Ø-Ð-Ð-Ð-Ð-Ð-à×)Ò)Ñ+Ô+ˆØ× Ò Ñ"Ô"ˆå ¨J¸CÐ@Ñ@Ô@ˆØˆŒØ	�	Š	‰ŒˆˆˆrL   c                óŽ   — t          d ¬¦  «        }d„ t          d¦  «        D ¦   «         }||_        |                     ¦   «          d S )Nr!  c                ó$   — g | ]}d |› �ddddœf‘ŒS )r  rÆ   rw   rc   )rÔ  rÕ  re   rä   rA  s     rJ   rC  z5TestExternal.testGraphVerticalBar.<locals>.<listcomp>H  s-   € ÐIÐIÐI¸!��q�� !¨!°!Ð4Ð4Ð5ÐIÐIÐIrL   r5   )rØ  r/   r:   râ   )rD   r  r:   s      rJ   ÚtestGraphVerticalBarz!TestExternal.testGraphVerticalBarF  sC   € Ý#¨tÐ4Ñ4Ô4ˆØIÐI½uÀR¹y¼yÐIÑIÔIˆØˆŒØ	�	Š	‰ŒˆˆˆrL   rY   )r÷   rø   rù   r`   r  r$  r&  rE  rR  r[  rb  re  rä   rL   rJ   r  r  ‰  s˜   € € € € € Ø€Dðð ð ð0ð ð ðð ð ð /ð /ð /ðbð ð ð:*ð *ð *ðXð ð ð ðð ð ð ð rL   r  Ú__main__)*rú   Ú
__future__r   rg  ró   r  Útypingr¯   ÚunittestÚTYPE_CHECKINGÚmatplotlib.axesræ  Úmatplotlib.figureÚmusic21r   Úmusic21.converter.subConvertersr   r   Úmusic21.graph.utilitiesr   r   r	   r
   r   ÚEnvironmentr§   ÚProtoM21Objectr   r  r.  rL  r€  r”  rÃ  rÌ  rØ  rö  ÚTestCaser  r  r÷   ÚmainTesträ   rL   rJ   ú<module>rt     s©  ððð ð #Ð "Ð "Ð "Ð "Ð "à €€€Ø €€€Ø €€€Ø Ð Ð Ð Ø €€€à„?ð ØÐÐÐØÐÐÐà Ð Ð Ð Ð Ð Ø 8Ð 8Ð 8Ð 8Ð 8Ð 8Ø Ð Ð Ð Ð Ð ð'ð 'ð 'ð 'ð 'ð 'ð 'ð 'ð 'ð 'ð 'ð 'ð
 Ð Ð Ð Ð Ð à&ˆ{Ô&Ð'9Ñ:Ô:€ðnð nð nð nð nˆGÔ"ñ nô nð nðbnð nð nð nð n�Uñ nô nð nðbWð Wð Wð Wð W˜5ñ Wô Wð WðtW'ð W'ð W'ð W'ð W'˜ñ W'ô W'ð W'ðtE#ð E#ð E#ð E#ð E# ñ E#ô E#ð E#ðhK-ð K-ð K-ð K-ð K-˜5ñ K-ô K-ð K-ð\:Að :Að :Að :Að :A�5ñ :Aô :Að :Aðz<Dð <Dð <Dð <Dð <D�Uñ <Dô <Dð <Dð~`:ð `:ð `:ð `:ð `:˜eñ `:ô `:ð `:ðFv6ð v6ð v6ð v6ð v6�%ñ v6ô v6ð v6ðr%ð %ð %ð %ð %ˆ8Ôñ %ô %ð %ðAð Að Að Að A�8Ô$ñ Aô Að AðH ˆzÒÐØ€N€N€NØ€GÔ�TÑÔÐÐÐð ÐrL   