WL i 6"ddlmZddlZddlmZmZddlmZmZm Z ddl m Z ddl m Z ddlmZddlmZdd lmZddlZdd lmZmZdd lmZmZdd lmZer.dd lmZddl m!Z!ddlm"Z"ddl#m$Z$ddl%m&Z&ddl'm(Z(m)Z)ddl*m+Z+m,Z,GddeZ-y)) annotationsN) TYPE_CHECKINGAny) export_png export_svgshow)get_screenshot_as_png)gridplot)Label) Category10)figure) as_fill_type as_line_type)filled_to_bokehlines_to_bokeh)Renderer)OutputBackendType)GridPlot)Palette) ArrayLike) WebDriver)FillTypeLineType) FillReturn LineReturnceZdZUdZded<ded<ded<ded < d dd Zdd Zdd Z d dd Z d ddZ d d!dZ d" d#dZ d$dd d%dZ ddd&dZ d'dZd(d)dZ d* d+dZy), BokehRendereraUtility renderer using Bokeh to render a grid of plots over the same (x, y) range. Args: nrows (int, optional): Number of rows of plots, default ``1``. ncols (int, optional): Number of columns of plots, default ``1``. figsize (tuple(float, float), optional): Figure size in inches (assuming 100 dpi), default ``(9, 9)``. show_frame (bool, optional): Whether to show frame and axes ticks, default ``True``. want_svg (bool, optional): Whether output is required in SVG format or not, default ``False``. Warning: :class:`~.BokehRenderer`, unlike :class:`~.MplRenderer`, needs to be told in advance if output to SVG format will be required later, otherwise it will assume PNG output. z list[figure]_figuresr_layoutr_palettebool _want_svgc||_td|_dtj|t z}||z}g|_|jrdnd}t|D]f} t|} d| j_ d| j_ |j j| |rOd| _ d| j_ ht|j |d|d|z|d |z |_y) N d)dtypesvgcanvas)output_backendFr)ncolstoolbar_locationwidthheight)r"r r npasarrayintrranger xgridvisibleygridappendoutline_line_coloraxisr r) selfnrowsr+figsize show_framewant_svg total_sizenfiguresbackend_figs c/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/contourpy/util/bokeh_renderer.py__init__zBokehRenderer.__init__2s""2 G377 ; .2nnU(x )A0C %CII  %CII  MM  %)-&#(  ) MMQ-5(A%1GI cpt|tr%|ddk(rt|dd}|j|}|S)NrCr*) isinstancestrr1r )r9colorindexs rC_convert_colorzBokehRenderer._convert_colorOs8 eS !eAh#oab NEMM%(E rEcDt|tr|j|}|S)N)rHr1r)r9axs rC _get_figurezBokehRenderer._get_figureUs b# r"B rEct|}|j|}|j|}t||\}}t |dkDr|j |g|g||dyy)aPlot filled contours on a single plot. Args: filled (sequence of arrays): Filled contour data as returned by :meth:`~.ContourGenerator.filled`. fill_type (FillType or str): Type of :meth:`~.ContourGenerator.filled` data as returned by :attr:`~.ContourGenerator.fill_type`, or a string equivalent. ax (int or Bokeh Figure, optional): Which plot to use, default ``0``. color (str, optional): Color to plot with. May be a string color or the letter ``"C"`` followed by an integer in the range ``"C0"`` to ``"C9"`` to use a color from the ``Category10`` palette. Default ``"C0"``. alpha (float, optional): Opacity to plot with, default ``0.7``. r)xsysrJ fill_alpha line_widthN)rrOrLrlenmulti_polygons) r9filled fill_typerNrJalpharBrQrRs rCrWzBokehRenderer.filledZsl*!+ r"##E* 3B r7Q;   2$B4u[\  ] rENc H|j|}|j||\}}t|t|jz} t|t|jz} ||d} |j| | fi| |dkDrd|ddddf|ddddfz|ddddfz|ddddfzzj } d|ddddf|ddddfz|ddddfz|ddddfzzj } |jtt j|ddddfj | |ddddfj fdtt j|ddddfj | |ddddfj fdfi| |jtt j|ddddfj | |ddddfj fdtt j|ddddfj | |ddddfj fdfi| |5|j|j |j |d|dd yy) a Plot quad grid lines on a single plot. Args: x (array-like of shape (ny, nx) or (nx,)): The x-coordinates of the grid points. y (array-like of shape (ny, nx) or (ny,)): The y-coordinates of the grid points. ax (int or Bokeh Figure, optional): Which plot to use, default ``0``. color (str, optional): Color to plot grid lines, default ``"black"``. alpha (float, optional): Opacity to plot lines with, default ``0.1``. point_color (str, optional): Color to plot grid points or ``None`` if grid points should not be plotted, default ``None``. quad_as_tri_alpha (float, optional): Opacity to plot ``quad_as_tri`` grid, default ``0``. Colors may be a string color or the letter ``"C"`` followed by an integer in the range ``"C0"`` to ``"C9"`` to use a color from the ``Category10`` palette. Warning: ``quad_as_tri_alpha > 0`` plots all quads as though they are unmasked. ) line_colorrYrg?Nr*)r8circle)xy fill_colorr[rYmarkersize) rO _grid_as_2dlistT multi_lineravelr/stackscatter)r9r_r`rNrJrY point_colorquad_as_tri_alpharBrQrRkwargsxmidymids rCgridzBokehRenderer.gridvs:r"1%1 !WtACCy  !WtACCy  %6r2(( q !CRC"H+!"crc' 2QssABwZ?!ABF)KLSSUD!CRC"H+!"crc' 2QssABwZ?!ABF)KLSSUD CNNRXXq"crc{002D!ABF)//:KLSTUVRXXq"crc{002D!ABF)//:KLSTUV   CNNRXXq"abz//1412ss79I9I9KLSTUVRXXq"abz//1412ss79I9I9KLSTUV    " KK'')qwwyUtSXa  ) #rEct|}|j|}|j|}t||\}} || J|j || |||yy)aPlot contour lines on a single plot. Args: lines (sequence of arrays): Contour line data as returned by :meth:`~.ContourGenerator.lines`. line_type (LineType or str): Type of :meth:`~.ContourGenerator.lines` data as returned by :attr:`~.ContourGenerator.line_type`, or a string equivalent. ax (int or Bokeh Figure, optional): Which plot to use, default ``0``. color (str, optional): Color to plot lines. May be a string color or the letter ``"C"`` followed by an integer in the range ``"C0"`` to ``"C9"`` to use a color from the ``Category10`` palette. Default ``"C0"``. alpha (float, optional): Opacity to plot lines with, default ``1.0``. linewidth (float, optional): Width of lines, default ``1``. Note: Assumes all lines are open line strips not closed line loops. N)r[ line_alpharT)rrOrLrline) r9lines line_typerNrJrY linewidthrBrQrRs rCrtzBokehRenderer.linessh4!+ r"##E*y1B >> !> HHR%IH V rEc"tjj|}|tjjury|j |}|j |}|j ||\}}|j|||||ddy)aPlot masked out grid points as circles on a single plot. Args: x (array-like of shape (ny, nx) or (nx,)): The x-coordinates of the grid points. y (array-like of shape (ny, nx) or (ny,)): The y-coordinates of the grid points. z (masked array of shape (ny, nx): z-values. ax (int or Bokeh Figure, optional): Which plot to use, default ``0``. color (str, optional): Circle color, default ``"black"``. Nr]r$)rarbrc)r/magetmasknomaskrOrLrdrj)r9r_r`zrNrJmaskrBs rCr|zBokehRenderer.masks}"uu}}Q 255<<  r"##E*1%1 AdGQtWxb QrE) webdriverc|r|jD]}d|_d|_|jrt |j ||yt |j ||y)aSave plots to SVG or PNG file. Args: filename (str): Filename to save to. transparent (bool, optional): Whether background should be transparent, default ``False``. webdriver (WebDriver, optional): Selenium WebDriver instance to use to create the image. .. versionadded:: 1.1.1 Warning: To output to SVG file, ``want_svg=True`` must have been passed to the constructor. N)filenamer})rbackground_fill_colorborder_fill_colorr"rrr)r9r transparentr}rBs rCsavezBokehRenderer.savesS( }} -,0)(,% - >> t||h) L t||h) LrEct|j|}tj}|j |d|S)aSave plots to an ``io.BytesIO`` buffer. Args: webdriver (WebDriver, optional): Selenium WebDriver instance to use to create the image. .. versionadded:: 1.1.1 Return: BytesIO: PNG image buffer. )driverpng)r rioBytesIOr)r9r}imagebuffers rCsave_to_bufferzBokehRenderer.save_to_buffers2&dll9E 65! rEc.t|jy)z:Show plots in web browser, in usual Bokeh manner. N)rr)r9s rCrzBokehRenderer.shows T\\rEc|j|}||_d|j_|!|j||j_yy)aSet the title of a single plot. Args: title (str): Title text. ax (int or Bokeh Figure, optional): Which plot to set the title of, default ``0``. color (str, optional): Color to set title. May be a string color or the letter ``"C"`` followed by an integer in the range ``"C0"`` to ``"C9"`` to use a color from the ``Category10`` palette. Default ``None`` which is ``black``. centerN)rOtitlealignrL text_color)r9rrNrJrBs rCrzBokehRenderer.titlesHr" "   #'#6#6u#=CII  rEc |j|}|j|}|j||\}}tj|}|j \} } |ddd} t | D]F} t | D]6} td || | f|| | f|| | f|dd| }|j|8H|rt | dz D]} t | dz D]} tj|| | dz| | dzf}tj|| | dz| | dzf}tj|| | dz| | dzf}|jtd ||||dd| yy) aShow ``z`` values on a single plot. Args: x (array-like of shape (ny, nx) or (nx,)): The x-coordinates of the grid points. y (array-like of shape (ny, nx) or (ny,)): The y-coordinates of the grid points. z (array-like of shape (ny, nx): z-values. ax (int or Bokeh Figure, optional): Which plot to use, default ``0``. color (str, optional): Color of added text. May be a string color or the letter ``"C"`` followed by an integer in the range ``"C0"`` to ``"C9"`` to use a color from the ``Category10`` palette. Default ``"green"``. fmt (str, optional): Format to display z-values, default ``".1f"``. quad_as_tri (bool, optional): Whether to show z-values at the ``quad_as_tri`` centres of quads. Warning: ``quad_as_tri=True`` shows z-values for all quads, even if masked. rmiddle)r text_align text_baseline)r_r`textr*N) rOrLrdr/r0shaper2r add_layoutmean)r9r_r`r{rNrJfmt quad_as_trirBnynxrmjilabelxxyyzzs rCz_valueszBokehRenderer.z_values(s6r"##E*1%1 JJqMB %XPXYr &A2Y &V!Q$1QT7AadGSE6?VvVu% & & 2a4[ Tr!tTA1QqS5!AaC%<1B1QqS5!AaC%<1B1QqS5!AaC%<1BNN5#R2RPvJ#R6#RS T T rE)r*r*) rTF) r:r1r+r1r;ztuple[float, float]r<r!r=r!returnNone)rJrIrrI)rN figure | intrr )rC0gffffff?) rWrrXzFillType | strrNrrJrIrYfloatrr)rblackg?Nr)r_rr`rrNrrJrIrYrrk str | Nonerlrrr)rrg?r*)rtrruzLineType | strrNrrJrIrYrrvrrr)rr) r_rr`rr{z'ArrayLike | np.ma.MaskedArray[Any, Any]rNrrJrIrr)F)rrIrr!r}WebDriver | Nonerr)r}rrz io.BytesIO)rr)rN)rrIrNrrJrrr)rgreenz.1fF)r_rr`rr{rrNrrJrIrrIrr!rr)__name__ __module__ __qualname____doc____annotations__rDrLrOrWrprtr|rrrrrrrErCrrs O'- III% I  I  I I:  ^^"^  ^  ^  ^ ^@"&#$2) 2) 2)  2)  2)  2) 2)!2) 2)p W W" W  W  W  W W  WN R R R 3 R  R  R R8"M '+ MMM $ M  M<?C  >*!+T +T +T  +T  +T  +T+T+T +TrEr). __future__rrtypingrrbokeh.iorrrbokeh.io.exportr bokeh.layoutsr bokeh.models.annotations.labelsr bokeh.palettesr bokeh.plottingr numpyr/contourpy.enum_utilrrcontourpy.util.bokeh_utilrrcontourpy.util.rendererrbokeh.core.enumsr bokeh.modelsrr numpy.typingr#selenium.webdriver.remote.webdriverr contourpyrrcontourpy._contourpyrrrrrErCrsW" %111"1%!:E,2%&&=,;vTHvTrE