
    -e                       d Z ddlmZ ddlZ ej        e          ZddlmZ ddl	m
Z
mZmZmZ ddlZddlmZmZmZmZmZ ddlmZmZmZmZmZmZmZmZmZmZm Z m!Z!m"Z"m#Z#m$Z$m%Z%m&Z& dd	l'm(Z( dd
l)m*Z*m+Z+ ddl,m-Z- ddl.m/Z/m0Z0 ddl1m2Z2m3Z3m4Z4m5Z5m6Z6 ddl7m8Z8 ddl9m:Z: ddl;m<Z< ddl=m>Z> ddlm?Z?m@Z@mAZA ddlBmCZC ddlDmEZE ddlFmGZG ddlHmIZImJZJ ddlKmLZLmMZMmNZNmOZO ddlPmQZQmRZRmSZS ddlTmUZUmVZVmWZWmXZX ddlYmZZZm[Z[m\Z\ ddl]m^Z^m_Z_ ddl`maZambZbmcZc dZdd/d#Ze G d$ d%eJ          Zf G d& d'eJeI          Zgd( Zh G d) d*ei          Zjd+Zk G d, d-ej          Zld. ZmdS )0z2 Models for representing top-level plot objects.

    )annotationsN)contextmanager)Any	GeneratorLiteraloverload   )LocationOutputBackendPlace	PlaceTypeResetPolicy)BoolDictEitherEnumFloatIncludeInstanceInstanceDefaultIntListNullNullableOverrideReadonlyStringStructTuple)Optional)ScalarFillPropsScalarLineProps)find)errorwarning)BAD_EXTRA_RANGE_NAMEINCOMPATIBLE_SCALE_AND_RANGEREPEATED_LAYOUT_CHILDREQUIRED_RANGEREQUIRED_SCALE)MISSING_RENDERERS)Model)	nice_join)warn   )
AnnotationLegendTitle)Axis)Glyph)Grid)
GridCommon	LayoutDOM)DataRange1dFactorRangeRangeRange1d)GlyphRendererRendererTileRenderer)CategoricalScaleLinearScaleLogScaleScale)ColumnarDataSourceColumnDataSource
DataSource)
TileSourceWMTSTileSource)	HoverToolToolToolbar)GridPlotPlottyper   returnr   c                (    t          | | | |           S )N)leftrighttopbottom)r   rM   s    2lib/python3.11/site-packages/bokeh/models/plots.pyLRTBrV   l   s    t4T$????    c                  	    e Zd ZU dZd fdZd Zd Zd Zd Ze	d	             Z
e	d
             Ze	d             Ze	d             Ze	d             ZddZe	d             Ze	d             Ze	d             Ze	dd            Zej        dd            ZdddZddZdd!Zedd'            Zedd*            Zddd/Zddd6Zedd9            Z ee          dd;            Z ee           dd<            Z! ee"          dd=            Z# e$e%          dd>            Z& ee'          dd?            Z( e)e* e+e,          d@A          Z- e)e* e+e,          dBA          Z.e/ddF            Z0 e)e1 e+e2          dGA          Z3 e)e1 e+e2          dHA          Z4 e5e6 e)e*          dIJ          Z7 e5e6 e)e*          dKJ          Z8 e5e6 e)e1          dLJ          Z9 e5e6 e)e1          dMJ          Z: e;dNdOA          Z< e=e> e)e?           e+e?dPQ          dRA          @                    e6dS           ZA eB eCeD          dTdUA          ZE eFeGdVdWX          ZH eIdYZ          ZJ eK e)eL          d[J          ZM e)eN e+eN          d\A          ZO eB eCeD          d]d^A          ZP e;dNd_A          ZQ e;d0d`A          ZR eK e)eL          daJ          ZS eK e)eL          dbJ          ZT eK e)eL          dcJ          ZU eK e)eL          ddJ          ZV eK e)eL          deJ          ZW eIdfZ          ZXdgeYdh<    eIdfZ          ZZdgeYdi<    eBe[djJ          Z\ eBe[dkJ          Z] e=e; e^ e_e;                    dNdlA          Z` eae[dmJ          Zb eae[dnJ          Zc eae[doJ          Zd eae[dpJ          Ze eFefdqdrX          Zg eIdsZ          Zh eFefdtduX          Zi eIdsZ          Zj eBe[dvJ          Zk eBe[dwJ          Zl eBe[dxJ          Zm eBe[dyJ          Zn eBe[dzd{A          Zo e[d|d}J          Zp eBe[d~dA          Zq e[ddJ          Zr e[ddJ          Zs eCetddA          Zu e;d0dA          Zv ewddA          Zx eCeyddA          Zz e;d0dA          Z{ xZ|S )rL   zI Model representing a plot, containing glyphs, guides, annotations.

    rN   Nonec                :     t                      j        |i | d S Nsuper__init__selfargskwargs	__class__s      rU   r^   zPlot.__init__y   %    $)&)))))rW   c                    t          ||          }t          t          |                                 |                    S )au   Query this object and all of its references for objects that
        match the given selector.

        There are a few different ways to call the ``select`` method.
        The most general is to supply a JSON-like query dictionary as the
        single argument or as keyword arguments:

        Args:
            selector (JSON-like) : some sample text

        Keyword Arguments:
            kwargs : query dict key/values as keyword arguments

        Additionally, for compatibility with ``Model.select``, a selector
        dict may be passed as ``selector`` keyword argument, in which case
        the value of ``kwargs['selector']`` is used for the query.

        For convenience, queries on just names can be made by supplying
        the ``name`` string as the single parameter:

        Args:
            name (str) : the name to query on

        Also queries on just type can be made simply by supplying the
        ``Model`` subclass as the single parameter:

        Args:
            type (Model) : the type to query on

        Returns:
            seq[Model]

        Examples:

            .. code-block:: python

                # These three are equivalent
                p.select(selector={"type": HoverTool})
                p.select({"type": HoverTool})
                p.select(HoverTool)

                # These two are also equivalent
                p.select({"name": "mycircle"})
                p.select("mycircle")

                # Keyword arguments can be supplied in place of selector dict
                p.select({"name": "foo", "type": HoverTool})
                p.select(name="foo", type=HoverTool)

        )_select_helper_list_attr_splatr#   
references)r`   ra   rb   selectors       rU   selectzPlot.select|   s8    h "$//  T__%6%6 A ABBBrW   c                0    | |                     |          v S )z Return whether this plot is in a given row of a GridPlot.

        Args:
            row (int) : index of the row to test
            gridplot (GridPlot) : the GridPlot to check

        Returns:
            bool

        )row)r`   rl   gridplots      rU   rl   zPlot.row   s     x||C((((rW   c                0    | |                     |          v S )z Return whether this plot is in a given column of a GridPlot.

        Args:
            col (int) : index of the column to test
            gridplot (GridPlot) : the GridPlot to check

        Returns:
            bool

        )column)r`   colrm   s      rU   ro   zPlot.column   s     xs++++rW   c                    g }|D ]&}|                     t          | |g                      'd |D             }t          |          S )Nc                <    g | ]}t          |t                    |S  )
isinstancer3   .0objs     rU   
<listcomp>zPlot._axis.<locals>.<listcomp>   s'    ===z#t'<'<====rW   )extendgetattrrg   )r`   sidesobjssaxiss        rU   _axisz
Plot._axis   sX     	. 	.AKKa,,----==t===%%%rW   c                .    |                      dd          S )z[ Splattable list of :class:`~bokeh.models.axes.Axis` objects for the x dimension.

        abovebelowr   r`   s    rU   xaxisz
Plot.xaxis   s    
 zz'7+++rW   c                .    |                      dd          S )z[ Splattable list of :class:`~bokeh.models.axes.Axis` objects for the y dimension.

        rP   rQ   r   r   s    rU   yaxisz
Plot.yaxis   s    
 zz&'***rW   c                :    t          | j        | j        z             S )zG Splattable list of :class:`~bokeh.models.axes.Axis` objects.

        )rg   r   r   r   s    rU   r~   z	Plot.axis       
  
TZ 7888rW   c                    | j         | j        z   | j        z   | j        z   | j        z   }d |D             }t          |          S )z/ Splattable list of |Legend| objects.

        c                <    g | ]}t          |t                    |S rs   )rt   r1   ru   s     rU   rx   zPlot.legend.<locals>.<listcomp>   s'    DDD3JsF,C,CD3DDDrW   )r   r   rP   rQ   center_legend_attr_splat)r`   panelslegendss      rU   legendzPlot.legend   sH    
 dj(494tzADKODD&DDD!'***rW   c                B    d | j         D             }t          |          S )zM Splattable list of :class:`~bokeh.models.tools.HoverTool` objects.

        c                <    g | ]}t          |t                    |S rs   )rt   rH   ru   s     rU   rx   zPlot.hover.<locals>.<listcomp>   s'    JJJ#z#y/I/IJ#JJJrW   )toolsrg   )r`   hoverss     rU   hoverz
Plot.hover   s(    
 KJJJJ'''rW   	dimensionLiteral[0, 1]c                H    fd| j         D             }t          |          S )Nc                T    g | ]$}t          |t                    |j        k    "|%S rs   )rt   r5   r   )rv   rw   r   s     rU   rx   zPlot._grid.<locals>.<listcomp>   s5    cccjd.C.CcYbHbHbHbHbHbrW   )r   rg   )r`   r   grids    ` rU   _gridz
Plot._grid   s,    cccct{ccc%%%rW   c                ,    |                      d          S )z\ Splattable list of :class:`~bokeh.models.grids.Grid` objects for the x dimension.

        r   r   r   s    rU   xgridz
Plot.xgrid       
 zz!}}rW   c                ,    |                      d          S )z\ Splattable list of :class:`~bokeh.models.grids.Grid` objects for the y dimension.

        r/   r   r   s    rU   ygridz
Plot.ygrid  r   rW   c                :    t          | j        | j        z             S )zH Splattable list of :class:`~bokeh.models.grids.Grid` objects.

        )rg   r   r   r   s    rU   r   z	Plot.grid  r   rW   
list[Tool]c                    | j         j        S r[   toolbarr   r   s    rU   r   z
Plot.tools  s    |!!rW   r   c                    || j         _        d S r[   r   )r`   r   s     rU   r   z
Plot.tools  s    "rW   r   rw   r=   placer   c                    |t           vr't          d| dt          t                                t          | |                              |           dS )aG   Adds an object to the plot in a specified place.

        Args:
            obj (Renderer) : the object to add to the Plot
            place (str, optional) : where to add the object (default: 'center')
                Valid places are: 'left', 'right', 'above', 'below', 'center'.

        Returns:
            None

        zInvalid place 'z%' specified. Valid place values are: N)r   
ValueErrorr-   rz   append)r`   rw   r   s      rU   
add_layoutzPlot.add_layout  sc     `%``iX]N^N^``   	e##C(((((rW   
Tool | strc                    |D ]u}t          |t                    rt          j        |          }n*t          |t                    r|}nt	          d|          | j        j                            |           vdS )z Adds tools to the plot.

        Args:
            *tools (Tool) : the tools to add to the Plot

        Returns:
            None

        z(expected a string or Tool instance, got N)rt   strrI   from_stringr   r   r   r   )r`   r   tooltool_objs       rU   	add_toolszPlot.add_tools0  s      	0 	0D$$$ V+D11D$'' V !TD!T!TUUUL%%h////	0 	0rW   rI   c           	     
   |D ]}t          |t                    st          d          || j        j        vr,t          d| dt          | j        j                             | j        j                            |           dS )z Removes tools from the plot.

        Args:
            *tools (Tool) : the tools to remove from the Plot

        Returns:
            None

        z5All arguments to remove_tool must be Tool subclasses.zInvalid tool z  specified. Available tools are N)rt   rI   r   r   r   r-   remove)r`   r   r   s      rU   remove_toolszPlot.remove_toolsD  s      	, 	,DdD)) x !XYYYT\/// !v!v!vW`aeamasWtWt!v!vwwwL%%d++++	, 	,rW   glyphr4   rb   r   r<   c                    d S r[   rs   )r`   r   rb   s      rU   	add_glyphzPlot.add_glyphU  s    GJsrW   sourcerC   c                    d S r[   rs   )r`   r   r   rb   s       rU   r   zPlot.add_glyphW  s    cfcfrW   Nsource_or_glyphGlyph | ColumnarDataSourceGlyph | Nonec                8   t          |t                    r|}nt                      |}}t          |t                    st	          d          t          |t
                    st	          d          t          d||d|}| j                            |           |S )a   Adds a glyph to the plot with associated data sources and ranges.

        This function will take care of creating and configuring a Glyph object,
        and then add it to the plot's list of renderers.

        Args:
            source (DataSource) : a data source for the glyphs to all use
            glyph (Glyph) : the glyph to add to the Plot


        Keyword Arguments:
            Any additional keyword arguments are passed on as-is to the
            Glyph initializer.

        Returns:
            GlyphRenderer

        z<'source' argument to add_glyph() must be DataSource subclassz6'glyph' argument to add_glyph() must be Glyph subclass)data_sourcer   rs   )	rt   rC   rD   rE   r   r4   r<   	renderersr   )r`   r   r   rb   r   gs         rU   r   zPlot.add_glyphZ  s    & o'9:: 	@$FF,..EF&*-- 	][\\\%'' 	WUVVVDfEDDVDDa   rW   Ftile_source+TileSource | xyzservices.TileProvider | strretinaboolr>   c           	     V   t          |t                    st          |t          j                  r|}ntt          |t                    r_|                                }|dk    rd}|dk    rd}d|v r|                    dd          }d}t          j                            |          }|rdnd	}t          |
                    |
          |j        |                    dd          |                    dd                    }t          dd|i|}| j                            |           |S )a   Adds new ``TileRenderer`` into ``Plot.renderers``

        Args:
            tile_source (TileSource, xyzservices.TileProvider, str) :
                A tile source instance which contain tileset configuration

            retina (bool) :
                Whether to use retina version of tiles (if available)

        Keyword Arguments:
            Additional keyword arguments are passed on as-is to the tile renderer

        Returns:
            TileRenderer : TileRenderer

        esri_imageryesri_worldimageryosmopenstreetmap_mapnikr    Tz@2xN)scale_factormin_zoomr   max_zoom   )urlattributionr   r   r   rs   )rt   rF   xyzservicesTileProviderr   lowerreplace	providers
query_namerG   	build_urlhtml_attributiongetr>   r   r   )r`   r   r   rb   selected_providerr   tile_renderers          rU   add_tilezPlot.add_tile|  sO   " +z22 	+{'?@@ R$/!! K-- R)//11.00"5K%''"8K{**"-"5"5h"C"CK!F$/$9$D$D[$Q$Q!$*455L(%//\/JJ->*..z1==*..z2>>	  K %GGGGGm,,,rW   renderGenerator[None, None, None]c             #  6   K   |rd| _         dV  d| _         dS dS )z Takes care of turning a property on and off within a scope.

        Args:
            render (bool) :
                Turns the property hold_render on and off.
        TNF)hold_render)r`   r   s     rU   holdz	Plot.hold  s9        	%#DEEE$D	% 	%rW   
str | Nonec                    g }| j         s|                    d           | j        s|                    d           |rd                    |          d| z  z   S d S )Nx_rangey_range,  [%s])r   r   r   joinr`   missings     rU   _check_required_rangezPlot._check_required_range  f    |6W^^I666|6W^^I666 	799W%%$66	7 	7rW   c                    g }| j         s|                    d           | j        s|                    d           |rd                    |          d| z  z   S d S )Nx_scaley_scaler   r   )r   r   r   r   r   s     rU   _check_required_scalezPlot._check_required_scale  r   rW   c                D   g }t          | j                                                  }| j        r|                    | j                   t          | j                                                  }| j        r|                    | j                   | j        |D ]}t          |t          t          f          rBt          | j        t          t          f          s!|                    d| d| j                    `t          |t                    r:t          | j        t                    s |                    d| d| j                    | j        |D ]}t          |t          t          f          rBt          | j        t          t          f          s!|                    d| d| j                    `t          |t                    r:t          | j        t                    s |                    d| d| j                    |rd                    |          d| z  z   S d S )Nz incompatibility on x-dimension: r   z incompatibility on y-dimension: r   )listextra_x_rangesvaluesr   r   extra_y_rangesr   r   rt   r8   r;   r@   rA   r9   r?   r   r   )r`   incompatiblex_rangesy_rangesrngs        rU   "_check_compatible_scale_and_rangesz'Plot._check_compatible_scale_and_ranges  s6   "$+224455<6666+224455<6666<# b bcK#9:: b:dl]hjr\sCtCt b ''(`3(`(`RVR^(`(`aaaa[11 b*T\Sc:d:d b ''(`3(`(`RVR^(`(`aaa<# b bcK#9:: b:dl]hjr\sCtCt b ''(`3(`(`RVR^(`(`aaaa[11 b*T\Sc:d:d b ''(`3(`(`RVR^(`(`aaa 	<99\**Wt^;;	< 	<rW   c                    t          | j                  dk    r1t          d | j        D                       dk    rt          |           S d S d S )Nr   c                <    g | ]}t          |t                    |S rs   )rt   r0   rv   xs     rU   rx   z1Plot._check_missing_renderers.<locals>.<listcomp>  s)    ,a,a,a1zRSU_G`G`,aQ,a,a,arW   )lenr   r   r   r   s    rU   _check_missing_rendererszPlot._check_missing_renderers  sU    t~!##,a,a,a,a,a(b(bfg(g(gt99 $#(g(grW   c                    d} fddD             }g t          t                    dD ]\}t           |          D ]Id                    fd|                                D                       }|r||rdnd| d dz   z  }J]|r|S d S )	Nr   c           
     F    i | ]}| d dht          d| d          S )_namedefaultextra_r}   rz   )rv   r~   r`   s     rU   
<dictcomp>z4Plot._check_bad_extra_range_name.<locals>.<dictcomp>  sO     
 
 
 NNNYI7G7G7G7G)H)HI
 
 
rW   )r   r   r   r   c              3  p   K   | ]0\  }}t          |d           |v| dt          |           dV  1dS )r  z=''Nr  )rv   r~   keysrefs      rU   	<genexpr>z3Plot._check_bad_extra_range_name.<locals>.<genexpr>  se          "dsD)44D@@ 44wsD11444@@@@   rW   z [])r   r   rz   r   items)r`   msgvalidr   badr  s   `    @rU   _check_bad_extra_range_namez Plot._check_bad_extra_range_name  s   
 
 
 
.
 
 
 1tE{{0K0 	D 	DEtU++ D Dii        &+kkmm       
  DC/DDRc3C3CS3C3C3CCCCD  	J	 	rW   zK
    The (default) data range of the horizontal dimension of the plot.
    r  helpzI
    The (default) data range of the vertical dimension of the plot.
    scale/Literal['auto', 'linear', 'log', 'categorical']rB   c                    |dv rt                      S |dk    rt                      S |dk    rt                      S t          d|           )N)autolinearlogcategoricalzUnknown mapper_type: )r@   rA   r?   r   )clsr  s     rU   _scalezPlot._scale  sY    &&&== e^^::M!!#%%%<U<<===rW   zr
    What kind of scale to use to convert x-coordinates in data space
    into x-coordinates in screen space.
    zr
    What kind of scale to use to convert y-coordinates in data space
    into y-coordinates in screen space.
    z~
    Additional named ranges to make available for mapping x-coordinates.

    This is useful for adding additional axes.
    )r  z~
    Additional named ranges to make available for mapping y-coordinates.

    This is useful for adding additional axes.
    z
    Additional named scales to make available for mapping x-coordinates.

    This is useful for adding additional axes.

    .. note:: This feature is experimental and may change in the short term.
    z
    Additional named scales to make available for mapping y-coordinates.

    This is useful for adding additional axes.

    .. note:: This feature is experimental and may change in the short term.
    Tz3
    Whether to use HiDPI mode when available.
    r   textzK
    A title for the plot. Can be a text string or a Title annotation.
    c                "    t          |           S )Nr   )r2   r   s    rU   <lambda>zPlot.<lambda>;  s    e&6&6&6 rW   r   z`
    Where the title will be located. Titles on the left or right side
    will be rotated.
    outlinez1
    The {prop} for the plot border outline.
    )prefixr  z#e5e5e5)r  z
    A list of all glyph renderers for this plot.

    This property can be manipulated by hand, but the ``add_glyph`` is
    recommended to help make sure all necessary setup is performed.
    z
    The toolbar associated with this plot which holds all the tools. It is
    automatically created with the plot if necessary.
    rQ   zi
    Where the toolbar will be located. If set to None, no toolbar
    will be attached to the plot.
    z
    Stick the toolbar to the edge of the plot. Default: True. If False,
    the toolbar will be outside of the axes, titles etc.
    z
    Locate the toolbar inside the frame. Setting this property to ``True``
    makes most sense with auto-hidden toolbars.
    zI
    A list of renderers to occupy the area to the left of the plot.
    zJ
    A list of renderers to occupy the area to the right of the plot.
    zC
    A list of renderers to occupy the area above of the plot.
    zC
    A list of renderers to occupy the area below of the plot.
    zL
    A list of renderers to occupy the center area (frame) of the plot.
    iX  z
int | Nonewidthheightzv
    The width of a plot frame or the inner width of a plot, excluding any
    axes, titles, border padding, etc.
    zx
    The height of a plot frame or the inner height of a plot, excluding any
    axes, titles, border padding, etc.
    at  
    Allows to specify which frame edges to align in multiple-plot layouts.

    The default is to align all edges, but users can opt-out from alignment
    of each individual edge or all edges. Note also that other proproperties
    may disable alignment of certain edges, especially when using fixed frame
    size (``frame_width`` and ``frame_height`` properties).
    al  
    This is the exact width of the plotting canvas, i.e. the width of
    the actual plot, without toolbars etc. Note this is computed in a
    web browser, so this property will work only in backends capable of
    bidirectional communication (server, notebook).

    .. note::
        This is an experimental feature and the API may change in near future.

    an  
    This is the exact height of the plotting canvas, i.e. the height of
    the actual plot, without toolbars etc. Note this is computed in a
    web browser, so this property will work only in backends capable of
    bidirectional communication (server, notebook).

    .. note::
        This is an experimental feature and the API may change in near future.

    aa  
    This is the exact width of the layout, i.e. the height of
    the actual plot, with toolbars etc. Note this is computed in a
    web browser, so this property will work only in backends capable of
    bidirectional communication (server, notebook).

    .. note::
        This is an experimental feature and the API may change in near future.

    ab  
    This is the exact height of the layout, i.e. the height of
    the actual plot, with toolbars etc. Note this is computed in a
    web browser, so this property will work only in backends capable of
    bidirectional communication (server, notebook).

    .. note::
        This is an experimental feature and the API may change in near future.

    
backgroundz3
    The {prop} for the plot background style.
    z#ffffffborderz/
    The {prop} for the plot border style.
    z
    Minimum size in pixels of the padding region above the top of the
    central plot region.

    .. note::
        This is a *minimum*. The padding region may expand as needed to
        accommodate titles or axes, etc.

    z
    Minimum size in pixels of the padding region below the bottom of
    the central plot region.

    .. note::
        This is a *minimum*. The padding region may expand as needed to
        accommodate titles or axes, etc.

    z
    Minimum size in pixels of the padding region to the left of
    the central plot region.

    .. note::
        This is a *minimum*. The padding region may expand as needed to
        accommodate titles or axes, etc.

    z
    Minimum size in pixels of the padding region to the right of
    the central plot region.

    .. note::
        This is a *minimum*. The padding region may expand as needed to
        accommodate titles or axes, etc.

       z
    A convenience property to set all all the ``min_border_X`` properties
    to the same value. If an individual border property is explicitly set,
    it will override ``min_border``.
    
   zL
    Decimation factor to use when applying level-of-detail decimation.
    i  z
    A number of data points, above which level-of-detail downsampling may
    be performed by glyph renderers. Set to ``None`` to disable any
    level-of-detail downsampling.
    i,  zo
    Interval (in ms) during which an interactive tool event will enable
    level-of-detail downsampling.
    i  a  
    Timeout (in ms) for checking whether interactive tool events are still
    occurring. Once level-of-detail mode is enabled, a check is made every
    ``lod_timeout`` ms. If no interactive tool events have happened,
    level-of-detail mode is disabled.
    canvasz
    Specify the output backend for the plot area. Default is HTML5 Canvas.

    .. note::
        When set to ``webgl``, glyphs without a WebGL rendering implementation
        will fall back to rendering onto 2D canvas.
    a;  
    Specify the aspect ratio behavior of the plot. Aspect ratio is defined as
    the ratio of width over height. This property controls whether Bokeh should
    attempt to match the (width/height) of *data space* to the (width/height)
    in pixels of *screen space*.

    Default is ``False`` which indicates that the *data* aspect ratio and the
    *screen* aspect ratio vary independently. ``True`` indicates that the plot
    aspect ratio of the axes will match the aspect ratio of the pixel extent
    the axes. The end result is that a 1x1 area in data space is a square in
    pixels, and conversely that a 1x1 pixel is a square in data units.

    .. note::
        This setting only takes effect when there are two dataranges. This
        setting only sets the initial plot draw and subsequent resets. It is
        possible for tools (single axis zoom, unconstrained box zoom) to
        change the aspect ratio.

    .. warning::
        This setting is incompatible with linking dataranges across multiple
        plots. Doing so may result in undefined behavior.
    r/   a  
    A value to be given for increased aspect ratio control. This value is added
    multiplicatively to the calculated value required for ``match_aspect``.
    ``aspect_scale`` is defined as the ratio of width over height of the figure.

    For example, a plot with ``aspect_scale`` value of 2 will result in a
    square in *data units* to be drawn on the screen as a rectangle with a
    pixel width twice as long as its pixel height.

    .. note::
        This setting only takes effect if ``match_aspect`` is set to ``True``.
    standardaq  
    How a plot should respond to being reset. By deafult, the standard actions
    are to clear any tool state history, return plot ranges to their original
    values, undo all selections, and emit a ``Reset`` event. If customization
    is desired, this property may be set to ``"event_only"``, which will
    suppress all of the actions except the Reset event.
    a  
    When set to True all requests to repaint the plot will be hold off.

    This is useful when periodically updating many glyphs. For example, let's
    assume we have 10 lines on a plot, each with its own datasource. We stream
    to all of them every second in a for loop like so:

    .. code:: python

        for line in lines:
            line.stream(new_points())

    The problem with this code is that every stream triggers a re-rendering of
    the plot. Even tough repainting only on the last stream would produce almost
    identical visual effect. Especially for lines with many points this becomes
    computationally expensive and can freeze your browser. Using a convenience
    method `hold`, we can control when rendering is initiated like so:

    .. code:: python

        with plot.hold(render=True):
            for line in lines:
                line.stream(new_points())

    In this case we render newly appended points only after the last stream.
    rN   rY   )r   r   )rN   r   )r   r   )r   )rw   r=   r   r   rN   rY   )r   r   rN   rY   )r   rI   rN   rY   )r   r4   rb   r   rN   r<   )r   rC   r   r4   rb   r   rN   r<   r[   )r   r   r   r   rb   r   rN   r<   )F)r   r   r   r   rb   r   rN   r>   )r   r   rN   r   )rN   r   )r  r  rN   rB   )}__name__
__module____qualname____doc__r^   rj   rl   ro   r   propertyr   r   r~   r   r   r   r   r   r   r   setterr   r   r   r   r   r   r   r   r$   r)   r   r*   r   r'   r   r%   r+   r  r&   r  r   r:   r   r8   r   r   classmethodr  rB   r@   r   r   r   r   r   r   extra_x_scalesextra_y_scalesr   hidpir   r   r2   acceptstitler   r   r
   title_locationr   r"   outline_propsr   outline_line_colorr   r=   r   rJ   r   toolbar_locationtoolbar_stickytoolbar_innerrP   rQ   r   r   r   r&  __annotations__r'  r   frame_widthframe_heightrV   r    frame_alignr   inner_widthinner_heightouter_widthouter_heightr!   background_propsbackground_fill_colorborder_propsborder_fill_colormin_border_topmin_border_bottommin_border_leftmin_border_right
min_border
lod_factorlod_thresholdlod_intervallod_timeoutr   output_backendmatch_aspectr   aspect_scaler   reset_policyr   __classcell__rc   s   @rU   rL   rL   s   sj
         
* * * * * *7C 7C 7Cr) ) ), , ,& & & , , X, + + X+ 9 9 X9 + + X+ ( ( X(& & & &   X   X 9 9 X9 " " " X" \# # # \#) ) ) ) )&0 0 0 0(, , , ," JJJ XJfff Xf         D0 0 0 0 0d 
% 
% 
% ^
% U>7 7 7 7 U>7 7 7 7 U'((< < < )(<0 W     U     ! $ huook&B&B J 	 	 	G huook&B&B J 	 	 	G > > > [> huook&B&B J 	 	 	G
 huook&B&B J 	 	 	G
 T&((5// 9 	 	 	N T&((5// 9 	 	 	N T&((5// 9 	 	 	N T&((5// 9 	 	 	N D % 	 	 	E F4%//%b2Q2Q2Q Y 	 	 		66	7	7 
 Xdd8nng E 	 	 	N
 GOI E 	 	 	M ")444XXh'' / 	 	 	I hw(@(@ H 	 	 	G
  xX G 	 	 	
 T$ . 	 	 	N
 D . 	 	 	M
 4"" * 	 	 	D D(## + 	 	 	E D(## + 	 	 	E D(## + 	 	 	E T((8$$ , 	 	 	F !---E----!#...F....(3 & 	 	 	K
 8C ' 	 	 	L
 &ttHHTNN33T I 	 	 	K (3 	& 		 		 		K 8C 	' 		 		 		L (3 	& 		 		 		K 8C 	' 		 		 		L w| K 	 	 	 %HY7777?8 C 	 	 	L !333Xc ) 	 	 	N ! , 	 	 	 hs * 	 	 	O  x + 	 	 	 #q 0 	 	 	J R  	 	 	J HS$ 6 	 	 	M 3s " 	 	 	L
 #c ! 	 	 	K T- A 	 	 	N 4 - 	 	 	L. 5 * 	 	 	L 4Z ? 	 	 	L $u , 	 	 	KKKKKrW   rL   c                  ,    e Zd ZdZd fdZ ee ee          d          Z e	 e
e          dd          Z e e e ee          ee           e ee          eeee                    g d	          Z ee          d
             Z xZS )rK   zS Collection of plots and other layoutables on arranged on a rectangular grid.

    rN   rY   c                :     t                      j        |i | d S r[   r\   r_   s      rU   r^   zGridPlot.__init___  rd   rW   z
    The toolbar associated with this grid plot, which holds all the tools.
    It is automatically created with the plot if necessary.
    r  r   z
    Indicates where the layout the toolbar will be located. If set to None,
    no toolbar will be attached to the grid plot.
    z
    A list of subplots with their associated position in the grid, row and column
    index and optional row and column spans (the defaul span is 1).
    c                    d | j         D             }t          |          t          t          |                    k    rt          |           S d S )Nc                    g | ]
}|d          S )r   rs   )rv   childs     rU   rx   z<GridPlot._check_repeated_layout_children.<locals>.<listcomp>u  s    :::%U1X:::rW   )childrenr  setr   )r`   ra  s     rU   _check_repeated_layout_childrenz(GridPlot._check_repeated_layout_childrens  sJ    ::4=:::x==CH....t99 /.rW   r.  )r/  r0  r1  r2  r^   r   rJ   r   r   r   r   r
   r>  r   r   r   r7   r   ra  r$   r(   rc  rZ  r[  s   @rU   rK   rK   Y  s.        
* * * * * * hw(@(@ H 	 	 	G
  xX G 	 	 	
 tFFhhy!!3,,hhy!!3S#668 8AC K	 	 	H U !!  "!    rW   rK   c                D    | |v r||v rt          d| d|          d S d S )Nz$Conflicting properties set on plot: z and )r   )a1a2rb   s      rU   _check_conflicting_kwargsrg    s=    	V||fQQQ2QQRRR |rW   c                       e Zd Zd Zd Zd ZdS )rg   c                2    | D ]}t          |||           d S r[   )setattr)r`   attrvaluer   s       rU   __setattr__z_list_attr_splat.__setattr__  s0     	$ 	$AAtU####	$ 	$rW   c                   t          t                    v rt                              |           S t          |           dk    rt	          dz            t          |           dk    rt          | d                   S 	 t          fd| D                       S # t          $ r t	          ddd          w xY w)Nr   z;Trying to access %r attribute on an empty 'splattable' listr/   c                0    g | ]}t          |          S rs   r  )rv   r   rk  s     rU   rx   z5_list_attr_splat.__getattribute__.<locals>.<listcomp>  s#    $D$D$D!WQ%5%5$D$D$DrW   zTrying to access z: attribute on a 'splattable' list, but list items have no z
 attribute)dirr   __getattribute__r  AttributeErrorrz   rg   	Exception)r`   rk  s    `rU   rq  z!_list_attr_splat.__getattribute__  s    3t99((t444t99>> !^ae!effft99>>47D)))	K#$D$D$D$Dt$D$D$DEEE 	K 	K 	K   "JT  "J  "Jw{  "J  "J  "J  K  K  K	Ks   B !B>c                    t          d | D                       dk    rt          | d                   S t          |           S )Nc                ,    h | ]}t          |          S rs   rT   r   s     rU   	<setcomp>z+_list_attr_splat.__dir__.<locals>.<setcomp>  s    &&&AQ&&&rW   r/   r   )r  rp  r   s    rU   __dir__z_list_attr_splat.__dir__  s@    &&&&&''1,,tAw<<t99rW   N)r/  r0  r1  rm  rq  rw  rs   rW   rU   rg   rg     sD        $ $ $
K 
K 
K    rW   rg   z
You are attempting to set `plot.legend.%s` on a plot that has zero legends added, this will have no effect.

Before legend properties can be set, you must add a Legend explicitly, or call a glyph method with a legend parameter set.
c                       e Zd Z fdZ xZS )r   c                    t          |           st          t          |z             t                                          ||          S r[   )r  r.   _LEGEND_EMPTY_WARNINGr]   rm  )r`   rk  rl  rc   s      rU   rm  z_legend_attr_splat.__setattr__  s?    4yy 	/&-...ww""4///rW   )r/  r0  r1  rm  rZ  r[  s   @rU   r   r     s8        0 0 0 0 0 0 0 0 0rW   r   c                   t          |           dk    rt          d          t          |           dk    r"t          |          dk    rt          d          t          |           dk    r"t          |          dk    rt          d          | r| d         }t          |t                    r|}nt          |t                    rt          |          }not          |t
                    rt          |t                    rd|i}n@t          d          d	|v r+t          |          dk    r	|d	         }nt          d
          |}|S )zA Allow flexible selector syntax.

    Returns:
        dict

    r/   z/select accepts at most ONE positional argument.r   zMselect accepts EITHER a positional argument, OR keyword arguments (not both).zCselect requires EITHER a positional argument, OR keyword arguments.)namerM   z5selector must be a dictionary, string or plot object.ri   zJwhen passing 'selector' keyword arg, not other keyword args may be present)r  	TypeErrorrt   dictr   rM   
issubclassr,   )ra   rb   argri   s       rU   rf   rf     sK    4yy1}}IJJJ
4yy1}}Vqghhh
4yyA~~#f++**]^^^ 1gc4   	UHHS!! 	U~~~HHT"" 	Uz#u'='= 	U}HHSTTT	v		v;;!j)HHhiii OrW   )rM   r   rN   r   )nr2  
__future__r   logging	getLoggerr/  r  
contextlibr   typingr   r   r   r   r   
core.enumsr
   r   r   r   r   core.propertiesr   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   core.property.structr    core.property_mixinsr!   r"   
core.queryr#   core.validationr$   r%   core.validation.errorsr&   r'   r(   r)   r*   core.validation.warningsr+   modelr,   util.stringsr-   util.warningsr.   r0   r1   r2   axesr3   glyphsr4   gridsr5   layoutsr6   r7   rangesr8   r9   r:   r;   r   r<   r=   r>   scalesr?   r@   rA   rB   sourcesrC   rD   rE   tilesrF   rG   r   rH   rI   rJ   __all__rV   rL   rK   rg  r   rg   rz  r   rf   rs   rW   rU   <module>r     s    # " " " " " g!! & % % % % %                                                                 & , + + + + + C C C C C C C C       , , , , , , , ,              9 8 8 8 8 8       $ $ $ $ $ $             2 2 2 2 2 2 2 2 2 2                   * * * * * * * *            = < < < < < < < < <            F E E E E E E E E E - - - - - - - - + + + + + + + + + +
@ @ @ @d	 d	 d	 d	 d	9 d	 d	 d	L    y*   PS S S    t   , 0 0 0 0 0) 0 0 0$ $ $ $ $rW   