L i8ddlZddlmZddlmZ ddlmZm Z m Z ddl m Z ddlmZmZmZmZmZgdZd Zd Zd Zdd Zdd ZddZddZddZy#e $rdZY@wxYw)N)LinearSegmentedColormap)interact FloatSlider IntSlidercd}t|)NzBInteractive palettes require `ipywidgets`, which is not installed.) ImportError)fmsgs U/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/seaborn/widgets.pyrrsR#)palplot) color_palette dark_palette light_palettediverging_palettecubehelix_palette)choose_colorbrewer_palettechoose_cubehelix_palettechoose_dark_palettechoose_light_palettechoose_diverging_palettectdd}tjd|}|j|j |S)zACreate a matplotlib colormap that will be updated by the widgets.Greys interactive)rr from_list_init _set_extremes)greyscmaps r _init_mutable_colormapr"s: '3 'E " , ,]E BDJJL Kr cB||jdd|jy)z8Change the LUT values in a matplotlib colormap in-place.Nr)_lutr)r!colorss r _update_lutr&sDIIdsOr c ddlm}|d5tjd\}}dddj ggt j ddd t jddf}|j|| y#1swY\xYw) z&Show a continuous matplotlib colormap.r ) axes_stylewhite)g @g?)figsizeN)xticksyticksrr)r!) rcmodr(pltsubplotssetnplinspacenewaxis pcolormesh)r!r(r axxs r _show_cmapr7%ss! G 2 [122FF"RF  Aq#rzz1}-AMM!$M 22s BB c|jdr r tdgr t|jdr*gd}gd}t|dt ddd |ffd }nn|jd r*gd }d dg}t|dt ddd |ffd }n3|jdr"gd}t|dt ddd ffd }rSS)avSelect a palette from the ColorBrewer set. These palettes are built into matplotlib and can be used by name in many seaborn functions, or by passing the object returned by this function. Parameters ---------- data_type : {'sequential', 'diverging', 'qualitative'} This describes the kind of data you want to visualize. See the seaborn color palette docs for more information about how to choose this value. Note that you can pass substrings (e.g. 'q' for 'qualitative. as_cmap : bool If True, the return value is a matplotlib colormap rather than a list of discrete colors. Returns ------- pal or cmap : list of colors or matplotlib colormap Object that can be passed to plotting functions. See Also -------- dark_palette : Create a sequential palette with dark low values. light_palette : Create a sequential palette with bright low values. diverging_palette : Create a diverging palette from selected colors. cubehelix_palette : Create a sequential palette or colormap using the cubehelix system. qz)Qualitative palettes cannot be colormaps.s)rRedsGreensBluesOrangesPurplesBuGnBuPuGnBuOrRdPuBuPuRdRdPuYlGnPuBuGnYlGnBuYlOrBrYlOrRd)regularreversedark)rr minmaxvaluec|dk(r|dz }n |dk(r|dz }rKt|d|}ttj|tjdft yt|||ddt y)NrM_rrN_drrr&r1c_onesr7rnamendesatvariantr%as_cmapr!pals r choose_sequentialz5choose_colorbrewer_palette..choose_sequential\sy)# F" &tS%8D"%% (<"=>4 &tQ6A r d)RdBuRdGyPRGnPiYGBrBGRdYlBuRdYlGnSpectralrLrMrOc|dk(r|dz }rKt|d|}ttj|tjdft yt|||ddt y)NrMrVrrXr[s r choose_divergingz4choose_colorbrewer_palette..choose_divergingrsh)# &tS%8D"%% (<"=>4 &tQ6A r )Set1Set2Set3PairedAccentPastel1Pastel2Dark2c<t|||ddty)N)rr)r\r]r^ras r choose_qualitativez6choose_colorbrewer_palette..choose_qualitatives#4E2CF CLr ) startswith ValueErrorr"rr) data_typer`optsvariantsrbroryr!ras ` @@r rr/s@C WDEE C%'C 82 #'7$/A1A$F&.      c "0y) "&'#.1!1#E%-      c "/ $(G%0QAQ%G     Jr cgr t|dk(rt dfd }n5|dk(rt dfd }n|dk(rt dfd }rSS) a4Launch an interactive widget to create a dark sequential palette. This corresponds with the :func:`dark_palette` function. This kind of palette is good for data that range between relatively uninteresting low values and interesting high values. Requires IPython 2+ and must be used in the notebook. Parameters ---------- input : {'husl', 'hls', 'rgb'} Color space for defining the seed value. Note that the default is different than the default input for :func:`dark_palette`. as_cmap : bool If True, the return value is a matplotlib colormap rather than a list of discrete colors. Returns ------- pal or cmap : list of colors or matplotlib colormap Object that can be passed to plotting functions. See Also -------- dark_palette : Create a sequential palette with dark low values. light_palette : Create a sequential palette with bright low values. cubehelix_palette : Create a sequential palette or colormap using the cubehelix system. rgbc|||f}r&t|dd}t|tyt||dddtyNrrinputrr&r7r rgbr]colorr%r`r!ras r choose_dark_palette_rgbz4choose_dark_palette..choose_dark_palette_rgbL q!GE%eS>D&)4 %eQe<A r hlsc|||f}r&t|dd}t|tyt||dddtyNrrrr hlr:r]rr%r`r!ras r choose_dark_palette_hlsz4choose_dark_palette..choose_dark_palette_hlsrr huslc|||f}r&t|dd}t|tyt||dddtyNrrrr rr:rr]rr%r`r!ras r choose_dark_palette_huslz5choose_dark_palette..choose_dark_palette_huslsL q!GE%eS?D&)4 %eQf=A r gg?rr)rgrcrrr"r)rr`rrrr!ras ` @@r rrs> C%' ~ &.&.&.&-    % &.&.&.&-    & '/'.'.'.    Jr cgr t|dk(rt dfd }n5|dk(rt dfd }n|dk(rt dfd }rSS) a7Launch an interactive widget to create a light sequential palette. This corresponds with the :func:`light_palette` function. This kind of palette is good for data that range between relatively uninteresting low values and interesting high values. Requires IPython 2+ and must be used in the notebook. Parameters ---------- input : {'husl', 'hls', 'rgb'} Color space for defining the seed value. Note that the default is different than the default input for :func:`light_palette`. as_cmap : bool If True, the return value is a matplotlib colormap rather than a list of discrete colors. Returns ------- pal or cmap : list of colors or matplotlib colormap Object that can be passed to plotting functions. See Also -------- light_palette : Create a sequential palette with bright low values. dark_palette : Create a sequential palette with dark low values. cubehelix_palette : Create a sequential palette or colormap using the cubehelix system. rc|||f}r&t|dd}t|tyt||dddtyrrr&r7rrs r choose_light_palette_rgbz6choose_light_palette..choose_light_palette_rgbL q!GE&uc?D&)4 &uau=A r rc|||f}r&t|dd}t|tyt||dddtyrrrs r choose_light_palette_hlsz6choose_light_palette..choose_light_palette_hlsrr rc|||f}r&t|dd}t|tyt||dddtyrrrs r choose_light_palette_huslz7choose_light_palette..choose_light_palette_husl&sL q!GE&uc@D&)4 &uav>A r rrr)rr`rrrr!ras ` @@r rrs> C%' ~ '/'/'/'.    % '/'/'/'.    & (0(/(/(/    Jr c gr tttdddtdddtdddtdddtd ddd d d gffd }rSS)aLaunch an interactive widget to choose a diverging color palette. This corresponds with the :func:`diverging_palette` function. This kind of palette is good for data that range between interesting low values and interesting high values with a meaningful midpoint. (For example, change scores relative to some baseline value). Requires IPython 2+ and must be used in the notebook. Parameters ---------- as_cmap : bool If True, the return value is a matplotlib colormap rather than a list of discrete colors. Returns ------- pal or cmap : list of colors or matplotlib colormap Object that can be passed to plotting functions. See Also -------- diverging_palette : Create a diverging color palette or colormap. choose_colorbrewer_palette : Interactively choose palettes from the colorbrewer set, including diverging palettes. rrrQ rJ2r rllightrNc r)t|||||d|}t |t yt||||||| ddt yNr)rr&r7r) h_negh_posr:rsepr]centerr%r`r!ras r rz:choose_diverging_palette..choose_diverging_paletteYsQ &ueQ3VLF f % t &ueQ36JCF CLr )r"rr)r`rr!ras` @@r rr9s8 C%' A!#A " r , r , !2 .  * Jr c  gr tttdddtdddtddd tdd dtddd tddd tddd dffd }rSS)aLaunch an interactive widget to create a sequential cubehelix palette. This corresponds with the :func:`cubehelix_palette` function. This kind of palette is good for data that range between relatively uninteresting low values and interesting high values. The cubehelix system allows the palette to have more hue variance across the range, which can be helpful for distinguishing a wider range of values. Requires IPython 2+ and must be used in the notebook. Parameters ---------- as_cmap : bool If True, the return value is a matplotlib colormap rather than a list of discrete colors. Returns ------- pal or cmap : list of colors or matplotlib colormap Object that can be passed to plotting functions. See Also -------- cubehelix_palette : Create a sequential palette or colormap using the cubehelix system. rOrm rQrrr g?g?g333333?g333333?Fc  rPtd|||||||}t tj|tjdft yt|||||||| ddt yr)rr&r1rYrZr7r) n_colorsstartrotgammahuerrNrMr%r`r!ras r choose_cubehelixz2choose_cubehelix_palette..choose_cubehelixss &sE3'*E4BF beeFBGGCL$89 : t &xU'*E4BCF CLr )r"rrr)r`rr!ras` @@r rrts8 C%' "+r"C*qaqA(RQbA*qaqA(QAR@*qasC)aQcB!&& Jr )F)rF)numpyr1matplotlib.pyplotpyplotr.matplotlib.colorsr ipywidgetsrrrrmiscplotrpalettesrrrrr__all__r"r&r7rrrrrr r rsu5;; == '   ]@RjRj8v6[ s AAA