
    6Dh                     P    S SK Jr  S SKrS SKJr  S SKJr  S r	        SS jr
g)    )NumberN)
graph_objsc                 x    S[        U 5      S-
  -  n[        U 5       VVs/ s H  u  p#X!-  U/PM     snn$ s  snnf )z
Makes a list of colors into a colorscale-acceptable form

For documentation regarding to the form of the output, see
https://plot.ly/python/reference/#mesh3d-colorscale
g      ?   )len	enumerate)colorsscaleicolors       S/var/www/html/env/lib/python3.13/site-packages/plotly/figure_factory/_2d_density.pymake_linear_colorscaler   	   s>     3v;?#E/8/@A/@81QY/@AAAs   6c
                 j   X4 H9  n
[        S U
 5       5      (       a  M  [        R                  R                  S5      e   [	        U 5      [	        U5      :w  a  [        R                  R                  S5      e[
        R                  " US5      n[        U5      n[
        R                  " US5      n[
        R                  " US5      n[        R                  " U USS[        US   USS	9S
9n[        R                  " U USUUSSS9n[        R                  " U S[        US   S9SS9n[        R                  " US[        US   S9SS9nXX/n[        R                  " SSUUU	[        SS/SSS9[        SS/SSS9[        SS9SS[        SS/SSS9[        SS/SSS9S9n[        R                  " UUS9nU$ )a  
**deprecated**, use instead
:func:`plotly.express.density_heatmap`.

:param (list|array) x: x-axis data for plot generation
:param (list|array) y: y-axis data for plot generation
:param (str|tuple|list) colorscale: either a plotly scale name, an rgb
    or hex color, a color tuple or a list or tuple of colors. An rgb
    color is of the form 'rgb(x, y, z)' where x, y, z belong to the
    interval [0, 255] and a color tuple is a tuple of the form
    (a, b, c) where a, b and c belong to [0, 1]. If colormap is a
    list, it must contain the valid color types aforementioned as its
    members.
:param (int) ncontours: the number of 2D contours to draw on the plot
:param (str) hist_color: the color of the plotted histograms
:param (str) point_color: the color of the scatter points
:param (str) point_size: the color of the scatter points
:param (str) title: set the title for the plot
:param (float) height: the height of the chart
:param (float) width: the width of the chart

Examples
--------

Example 1: Simple 2D Density Plot

>>> from plotly.figure_factory import create_2d_density
>>> import numpy as np

>>> # Make data points
>>> t = np.linspace(-1,1.2,2000)
>>> x = (t**3)+(0.3*np.random.randn(2000))
>>> y = (t**6)+(0.3*np.random.randn(2000))

>>> # Create a figure
>>> fig = create_2d_density(x, y)

>>> # Plot the data
>>> fig.show()

Example 2: Using Parameters

>>> from plotly.figure_factory import create_2d_density

>>> import numpy as np

>>> # Make data points
>>> t = np.linspace(-1,1.2,2000)
>>> x = (t**3)+(0.3*np.random.randn(2000))
>>> y = (t**6)+(0.3*np.random.randn(2000))

>>> # Create custom colorscale
>>> colorscale = ['#7A4579', '#D56073', 'rgb(236,158,105)',
...              (1, 1, 0.2), (0.98,0.98,0.98)]

>>> # Create a figure
>>> fig = create_2d_density(x, y, colorscale=colorscale,
...       hist_color='rgb(255, 237, 222)', point_size=3)

>>> # Plot the data
>>> fig.show()
c              3   B   #    U  H  n[        U[        5      v   M     g 7f)N)
isinstancer   ).0elements     r   	<genexpr>$create_2d_density.<locals>.<genexpr>a   s     De7:gv..es   z7All elements of your 'x' and 'y' lists must be numbers.z/Both lists 'x' and 'y' must be the same length.rgbmarkerspointsr   g?)r   sizeopacity)xymodenamemarkerdensityTF)r   r   r   	ncontours
colorscalereversescale	showscalez	x density)r   y2)r   r   r   yaxisz	y densityx2)r   r   r   xaxisg333333?)domainshowgridzeroline2   )tclosestr   )
showlegendautosizetitleheightwidthr(   r&   margin	hovermodebargapxaxis2yaxis2)datalayout)allplotly
exceptionsPlotlyErrorr   clrsvalidate_colorsr   r   ScatterdictHistogram2dContour	HistogramLayoutFigure)r   r   r"   r!   
hist_colorpoint_color
point_sizer1   r2   r3   arraytrace1trace2trace3trace4r9   r:   figs                     r   create_2d_densityrP      s   X DeDDD##//I   1vQ++=
 	
 %%j%8J'
3J %%j%8J&&{E:K

+a.z3GF **

F !!
+dA&?tF !!
+dA&?tF F+D1d)eeD1d)eeDbzD!9uuED!9uuEF 

f
5CJ    )Earth   r   r   g      ?rT      z2D Density PlotX  rV   )numbersr   plotly.exceptionsr<   plotly.colorsr	   r?   plotly.graph_objsr   r   rP    rQ   r   <module>r\      s7       (B 

GrQ   