
    6Dh׮                         S SK JrJr  S SKJr  S SKJr  S SKJ	r	  S SK
Jr  \R                  " S5      r/ SQrSS	/rS
 rS rS rS rS rS r            SS jrg)    )
exceptionsoptional_importsN)utils)
graph_objs)make_subplotspandas)scatter	histogramboxcatseqc                    [        U 5      n[        U [        5      (       d+  [        U [        5      (       d  [        R
                  " S5      eU  H.  n[        U[        5      (       d  M  [        R
                  " S5      e   [        US-
  5       H&  nX   XS-      :  d  M  [        R
                  " S5      e   / nUR                  [        S5      U S   /5        [        US-
  5       H?  n/ nUR                  X   5        UR                  XS-      5        UR                  U5        MA     UR                  XS-
     [        S5      /5        U$ )a  
Returns a list of intervals for categorical colormaps

Accepts a list or tuple of sequentially increasing numbers and returns
a list representation of the mathematical intervals with these numbers
as endpoints. For example, [1, 6] returns [[-inf, 1], [1, 6], [6, inf]]

:raises: (PlotlyError) If input is not a list or tuple
:raises: (PlotlyError) If the input contains a string
:raises: (PlotlyError) If any number does not increase after the
    previous one in the sequence
zZThe intervals_endpts argument must be a list or tuple of a sequence of increasing numbers.   z-infr   inf)
len
isinstancetuplelistr   PlotlyErrorstrrangeappendfloat)endptslengthitemk	intervalsintervals         T/var/www/html/env/lib/python3.13/site-packages/plotly/figure_factory/_scatterplot.pyendpts_to_intervalsr!      s:    [Fv'':ft+E+E$$%
 	
 dC  ((   6A:91u%((   	%-34vz"AHOOFI&OOFq5M*X&	 # 	&!,eEl;<    c                     / nU S    H4  nUS   S:X  d  M  UR                  SR                  US   SS 5      5        M6     U H  nSU S	   U   S
'   M     g)z@
Hides tick labels for box plots in scatterplotmatrix subplots.
datatyper   xaxis{}xaxisr   NFlayoutshowticklabels)r   format)figboxplot_xaxestracer'   s       r    "hide_tick_labels_from_box_subplotsr.   B   si     MV=E!   !1!1%.2D!EF	 
 16He-. r"   c                 >  ^ [         (       d  [        S5      e[        U [         R                  R                  R
                  5      (       d  [        R                  " S5      e[        U R                  5      S::  a  [        R                  " S5      eU[        ;  a)  [        R                  " SR                  [        5      5      eU[        ;  a  [        R                  " S5      eST;   a5  / SQn[        U4S	 jU 5       5      (       a  [        R                  " S
5      egg)a  
Validates basic inputs for FigureFactory.create_scatterplotmatrix()

:raises: (PlotlyError) If pandas is not imported
:raises: (PlotlyError) If pandas dataframe is not inputted
:raises: (PlotlyError) If pandas dataframe has <= 1 columns
:raises: (PlotlyError) If diagonal plot choice (diag) is not one of
    the viable options
:raises: (PlotlyError) If colormap_type is not a valid choice
:raises: (PlotlyError) If kwargs contains 'size', 'color' or
    'colorscale'
z<FigureFactory.scatterplotmatrix requires a pandas DataFrame.zUDataframe not inputed. Please use a pandas dataframe to produce a scatterplot matrix.r   zUDataframe has only one column. To use the scatterplot matrix, use at least 2 columns.z"Make sure diag is set to one of {}zpMust choose a valid colormap type. Either 'cat' or 'seq' for a categorical and sequential colormap respectively.marker)sizecolor
colorscalec              3   2   >#    U  H  oTS    ;   v   M     g7f)r0   N ).0paramkwargss     r    	<genexpr>-validate_scatterplotmatrix.<locals>.<genexpr>   s     G6FUx((6Fs   zYour kwargs dictionary cannot include the 'size', 'color' or 'colorscale' key words inside the marker dict since 'size' is already an argument of the scatterplot matrix function and both 'color' and 'colorscale are set internally.N)pdImportErrorr   coreframe	DataFramer   r   r   columnsDIAG_CHOICESr*   VALID_COLORMAP_TYPESany)dfindexdiagcolormap_typer8   FORBIDDEN_PARAMSs       ` r    validate_scatterplotmatrixrI   P   s    2M
 	

 b"''--1122$$)
 	
 2::!$$
 	
 <$$3::<H
 	

 00$$
 	
 6:G6FGGG((&	 	 H r"   c                 ~   [        U 5      n[        XSS9n	/ n
U  H  nU  H  nX:X  a  US:X  a  [        R                  " USS9nO~X:X  a  US:X  a  [        R                  " USSS9nO\SU;   a3  X7S   S	'   [        R
                  " SXS
SS.UD6nU
R                  U5        O#[        R
                  " SUUS
[        US9SS.UD6nU
R                  U5        M     M     Sn[        SUS-   5      nU H&  nU H  nU	R                  X   UU5        US-  nM     M(     [        U5       H7  nSR                  X-  U-
  S-   U-   5      nU	S   U   R                  UU   S9  M9     [        U5       H2  nSR                  SUU-  -   5      nU	S   U   R                  UU   S9  M4     U	S   R                  XEUSS9  [        U	5        U	$ )zs
Refer to FigureFactory.create_scatterplotmatrix() for docstring

Returns fig for scatterplotmatrix without index

Frowscols
print_gridr
   )x
showlegendr   N)ynamerP   r0   r1   markersrO   rQ   moderP   )r1   rO   rQ   rU   r0   rP   r   r   r&   r(   titleyaxis{}TheightwidthrX   rP   r5   )r   r   r   	HistogramBoxScatterr   dictr   append_tracer*   updater.   )	dataframeheadersrF   r1   r[   r\   rX   r8   dimr+   
trace_listlistylistxr-   trace_indexindicesy_indexx_indexj	xaxis_key	yaxis_keys                        r    scatterplotrp      s    i.C
Su
=CJET[%8",,uG.tu}"TeLv%/38$V,&.. yUNTE %%e,&.. &##( !E e$+  0 KAsQwGGZ4gwG1K   3Z$$ci3%6%:Q%>?	Hi ''gaj'9  3Z$$Q#']3	Hi ''gaj'9  M5TR&s+Jr"   c                    U
n[        U 5      n[        XSS9n/ nSnU  GH-  nU  GH"  n0 nU H  nUU;  d  M  / UU'   M     [        UR                  5       5       GH  n/ n/ n[	        [        U5      5       H6  nUU   U:X  d  M  UR                  UU   5        UR                  UU   5        M8     US:X  a  UU:X  a(  US:X  a"  [        R                  " U[        UU   S9SS9nGOCUU:X  a)  US	:X  a#  [        R                  " US
[        UU   S9SS9nGOSU;   a/  X<S   S'   UU   US   S'   [        R                  " SUUSUSS.UD6nO[        R                  " SUUSU[        X=U   S9SS.UD6nOUU:X  a'  US:X  a!  [        R                  " U[        UU   S9SS9nOUU:X  a(  US	:X  a"  [        R                  " US
[        UU   S9SS9nO\SU;   a/  X<S   S'   UU   US   S'   [        R                  " SUUSUSS.UD6nO'[        R                  " SUUSU[        X=U   S9SS.UD6nUUU'   GM     UR                  U5        US-  nGM%     GM0     Sn[	        SUS-   5      nU HM  nU HD  n[        UU   R                  5       5       H  nUR                  UU   U   UU5        M     US-  nMF     MO     [	        U5       H7  nSR                  X-  U-
  S-   U-   5      nUS   U   R                  UU   S9  M9     [	        U5       H2  nSR                  SUU-  -   5      nUS   U   R                  UU   S9  M4     [        U5        US:X  a  US   R                  XEUSSS9  U$ US   R                  XEUSS9  U$ )a  
Refer to FigureFactory.create_scatterplotmatrix() for docstring

Returns fig for scatterplotmatrix with both index and colormap picked.
Used if colormap is a dictionary with index values as keys pointing to
colors. Forces colormap_type to behave categorically because it would
not make sense colors are assigned to each index value and thus
implies that a categorical approach should be taken

FrK   r   r   r
   r2   TrO   r0   rP   r   NrQ   rR   r0   rP   r0   r1   r2   rS   rO   rQ   rU   rR   rP   r1   r2   rO   rQ   rU   rR   r0   rP   r&   r(   rW   rY   stackr[   r\   rX   rP   barmoderZ   r5   )r   r   sortedkeysr   r   r   r]   r`   r^   r_   ra   r*   rb   r.   ) rc   rd   rF   r1   r[   r\   rX   rE   
index_valsr   colormaprG   r8   themere   r+   rf   legend_paramrg   rh   unique_index_valsrR   	new_listx	new_listyrm   r-   ri   rj   rk   rl   rn   ro   s                                    r    scatterplot_dictr      sH   4 E
i.C
Su
=CJLE ""00.0%d+ #
 05578		s:/A!!},!((q2!((q2 0
  1$T[-@ * 4 4'5;0GTX!  5.tu} *'!%#'eDk#:'+	! $v-7;8,V48=dF8,W5$.$6$6 %"+"+%.%)+/% #)%E %/$6$6 %"+"+%.%)'+4['I+/% #)%E T[-@ * 4 4'#'eDk#:',!
  5.tu} *'!%#'eDk#:',	! $v-7;8,V48=dF8,W5$.$6$6 %"+"+%.%)+0% #)%E %/$6$6 %"+"+%.%)'+4['I+0% #)%E +0!$'a 9b /0ALu  z KAsQwGGz+6;;=>  K!8!>Q ?1K   3Z$$ci3%6%:Q%>?	Hi ''gaj'9  3Z$$Q#']3	Hi ''gaj'9  's+{Heg 	 	
 
 	HFuQUV
r"   c                 Z   [        US   [        5      (       GaS  / nU H  nX;  d  M
  UR                  U5        M     [        U5      nUS:X  ah  [        R
                  " U
[        R                  5      n[        R                  " US   US   U5      n[        R
                  " U[        R                  5      nUS:X  a  U
n[        U 5      n[        UUSS9n/ nSnU  GHG  nU  GH<  n0 nU H  nX;  d  M
  / X'   M     Sn[        UR                  5       5       GH  n/ n/ n[        [        U5      5       H6  nUU   U:X  d  M  UR                  UU   5        UR                  UU   5        M8     US:X  a  UU:X  a(  US:X  a"  [        R                  " U[        WU   S9S	S
9nGOEUU:X  a)  US:X  a#  [        R                   " US[        WU   S9S	S9nGOSU;   a/  X<S   S'   WU   US   S'   [        R"                  " S$UUSUS	S.UD6nO[        R"                  " S$UUSU[        UWU   S9S	S.UD6nOUU:X  a'  US:X  a!  [        R                  " U[        WU   S9SS
9nOUU:X  a(  US:X  a"  [        R                   " US[        WU   S9SS9nO]SU;   a/  X<S   S'   WU   US   S'   [        R"                  " S$UUSUSS.UD6nO([        R"                  " S$UUSU[        UWU   S9SS.UD6nUX'   U[        U5      S-
  :  a  SnUS-  nGM     UR                  U5        US-  nGM?     GMJ     Sn[        SUS-   5      nU HM  nU HD  n [        UU   R                  5       5       H  nUR%                  UU   U   UU 5        M     US-  nMF     MO     [        U5       H8  nSR'                  UU-  U-
  S-   U-   5      n!US   U!   R)                  UU   S9  M:     [        U5       H2  nSR'                  SUU-  -   5      n"US   U"   R)                  UU   S9  M4     [+        U5        US:X  a  US   R)                  UUUS	SS9  U$ US:X  a  US   R)                  XEUS	S9  U$ US   R)                  XEUS	S9  U$ U	(       Ga^  [,        R.                  " U	5      n#US:X  aq  [        R
                  " U
[        R                  5      n[        R                  " US   US   [        U#5      5      n[        R
                  " U[        R                  5      nUS:X  a  U
n[        U 5      n[        UUSS9n/ nSnU  GHr  nU  GHg  n0 n$U# H  n%/ U$[        U%5      '   M     SnU# GH+  n%/ n/ n[        [        U5      5       HG  nU%S   UU   s=:  a  U%S   ::  d  M  O  M  UR                  UU   5        UR                  UU   5        MI     US:X  a  UU:X  a(  US:X  a"  [        R                  " U[        WU   S9S	S
9nGOiUU:X  a)  US:X  a#  [        R                   " US[        WU   S9S	S9nGO:SU;   a8  X<S   S'   WU   US   S'   [        R"                  " S$UUS[        U%5      S	S.UD6nO[        R"                  " S$UUS[        U%5      [        UWU   S9S	S.UD6nOUU:X  a'  US:X  a!  [        R                  " U[        WU   S9SS
9nOUU:X  a(  US:X  a"  [        R                   " US[        WU   S9SS9nOoSU;   a8  X<S   S'   WU   US   S'   [        R"                  " S$UUS[        U%5      SS.UD6nO1[        R"                  " S$UUS[        U%5      [        UWU   S9SS.UD6nUU$[        U%5      '   U[        U5      S-
  :  a  SnUS-  nGM.     UR                  U$5        US-  nGMj     GMu     Sn[        SUS-   5      nU H<  nU H3  n U# H%  n%UR%                  UU   [        U%5         UU 5        M'     US-  nM5     M>     [        U5       H8  nSR'                  UU-  U-
  S-   U-   5      n!US   U!   R)                  UU   S9  M:     [        U5       H2  nSR'                  SUU-  -   5      n"US   U"   R)                  UU   S9  M4     [+        U5        US:X  a  US   R)                  UUUS	SS9  U$ US:X  a  US   R)                  XEUS	S9  U$ US   R)                  XEUS	S9  U$ U
n[        U5      S::  a  UR                  US   5        / n&[        [        U5      5       H+  n'U&R                  S[        U5      S-
  -  U'-  UU'   /5        M-     [        U 5      n[        UUSS9n/ nSnU  GH  nU  GH  nUS:X  a  UU:X  a(  US:X  a"  [        R                  " U[        US   S9SS
9nGOUUU:X  a(  US:X  a"  [        R                   " U[        US   S9SS9nGO'SU;   a:  X<S   S'   XS   S'   U&US   S'   S	US   S '   [        R"                  " S$UUSSS!.UD6nO[        R"                  " S$UUS[        UUU&S	S"9SS#.UD6nOUU:X  a'  US:X  a!  [        R                  " U[        US   S9SS
9nOUU:X  a'  US:X  a!  [        R                   " U[        US   S9SS9nOfSU;   a:  X<S   S'   XS   S'   U&US   S'   SUS   S '   [        R"                  " S$UUSSS!.UD6nO&[        R"                  " S$UUS[        UUU&SS"9SS#.UD6nUR                  U5        US-  nGM     GM     Sn[        SUS-   5      nU H'  nU H  n UR%                  UU   UU 5        US-  nM      M)     [        U5       H8  nSR'                  UU-  U-
  S-   U-   5      n!US   U!   R)                  UU   S9  M:     [        U5       H2  nSR'                  SUU-  -   5      n"US   U"   R)                  UU   S9  M4     [+        U5        US:X  a  US   R)                  UUUS	SS9  U$ US:X  a  US   R)                  XEUS	S9  U$ US   R)                  XEUS	S9  U$ )%z
Refer to FigureFactory.create_scatterplotmatrix() for docstring

Returns fig for scatterplotmatrix with both index and colormap picked

r   r   r   r   FrK   r
   rr   Trs   r   Nrt   r0   r1   r2   rS   ru   rv   rw   r&   r(   rW   rY   rx   ry   rZ   g      ?)rQ   r0   rP   r3   	showscalerT   )r1   r2   r3   r   rV   r5   )r   r   r   r   clrscolor_parserunlabel_rgbn_colors	label_rgbr   r{   r|   r   r   r]   r`   r^   r_   ra   r*   rb   r.   r   r!   )(rc   rd   rF   r1   r[   r\   rX   rE   r}   r   r~   rG   r8   r   rR   n_colors_lenfoor   re   r+   rf   r   rg   rh   c_indxr   r   rm   r-   ri   rj   rk   rl   rn   ro   r   interval_labelsr   r2   incrs(                                           r    scatterplot_themer   e  s   . *Q-%%D,!((.  ,- E!##Hd.>.>?C--AA=C%%c4>>:EE!E)n35A
E"$&!&D424)/ ' "#4#9#9#;<D "I "I"3z?3%a=D0%,,U1X6%,,U1X6 4
 $q(!UN1D$.$8$8"+'+%-'@+/%E
 $un45=$.NN"+%)'+%-'@+/	%E  (61;?x 0 8<A&Mx 0 9(2(:(: )"&/&/)2)-/3)" '-)" )3(:(: )"&/&/)2)-+/Tv+O/3)" '-)" "UN1D$.$8$8"+'+%-'@+0%E
 $un45=$.NN"+%)'+%-'@+0	%E  (61;?x 0 8<A&Mx 0 9(2(:(: )"&/&/)2)-/4)" '-)" )3(:(: )"&/&/)2)-+/Tv+O/4)" '-)" /4%+#e*q.1!#aKFk =l !!"34!A # F 37#G"":k#:#?#?#ABD$$Z%<T%BGWU Cq  #  sA!((#)s):Q)>)BCIM)$++'!*+=  sA!((cAg7IM)$++'!*+=  	+3/;M   !  JU]M  %D !  J M  %D !  J 11&9I %''$2B2BCmmCFCFC	NC))#t~~>% i.CSsuECJL"&E&(O$-9;H6 %. F$-$&	$&	!&s:!7A'{Z]IhqkII ) 0 0q : ) 0 0q : "8
 (1, %T[5H(2(<(<&/+/eFm+D/3)"
 #(5.tu}(2&/)-+/eFm+D/3	)" $,v#5?C8$4V$<BG-VH%5g%>,6,>,> -&*3*3-6-0]37-& +1-&E -7,>,> -&*3*3-6-0]/3U6]/S37-& +1-&E !&T[5H(2(<(<&/+/eFm+D/4)"
 #(5.tu}(2&/)-+/eFm+D/4	)" $,v#5?C8$4V$<BG-VH%5g%>,6,>,> -&*3*3-6-0]38-& +1-&E -7,>,> -&*3*3-6-0]/3U6]/S38-& +1-&E :?H6!c%j1n5%'F!k %.l %%o6 A%L} ' #B KAsQw'G"&G$-((&{3CMBGW %.  1$K  ' # 3Z%,,cCi3->-BQ-FG	Hi(//gaj/A   3Z%,,Q#'];	Hi(//gaj/A   /s3{"H$$!## %  
H$$!e %  
 H$$!e %  
 E 5zQU1X&Ec%j)cSZ!^4t;U4[IJ * i.CSsuECJL"&E#q(!UN1D$.$8$8"'580DQV%E $un45=$.NN"'580DQV%E  (61;?x 0 8<Fx 0 9AFx 0 >@Dx 0 =(2(:(: )"&+&+)2/4	)"
 '-)" )3(:(: )"&+&+)2+/-1.83826	,& 05)" '-)" "UN1D$.$8$8"'580DQV%E $un45=$.NN"'580DQV%E  (61;?x 0 8<Fx 0 9AFx 0 >@Ex 0 =(2(:(: )"&+&+)2/4	)"
 '-)" )3(:(: )"&+&+)2+/-1.83827	,& 05)" '-)" %%e, A%L[ ' #` KAsQw'G"&G$$Z%<gwO1$K  ' # 3Z%,,cCi3->-BQ-FG	Hi(//gaj/A   3Z%,,Q#'];	Hi(//gaj/A   /s3{"H$$!## %  
H$$!e %  
 H$$!e %  
r"   c                   ^ U
c  / n
Uc  / nUc  / n[        XX940 UD6  [        T[        5      (       a  [        R                  " TS5      mO[        T[
        5      (       a  ST;  a  ST;  a  T[        R                  R                  5       ;  aA  [        R                  " SR                  [        R                  R                  5       5      5      e[        R                  " [        R                  T   5      mTS   /TS   /-   m[        R                  " TS5      mO[        R                  " TS5      mU(       du  U  H  nUR                  U5        M     U H.  nU
R                  X   R                  R                  5       5        M0     [         R"                  " U
5        [%        XX6XEU40 UD6nU$ X;  a  [        R                  " S5      eX   R                  R                  5       nU  H  nX:w  d  M
  UR                  U5        M     U H.  nU
R                  X   R                  R                  5       5        M0     [         R"                  " U
5        [         R&                  " U5        [        T[        5      (       aR  T H3  n[)        U4S jU 5       5      (       a  M  [        R                  " S5      e   [+        U
UUUUUUUUUTU	40 UD6nU$ [-        U
UUUUUUUUUTU	40 UD6nU$ )	a  
Returns data for a scatterplot matrix;
**deprecated**,
use instead the plotly.graph_objects trace
:class:`plotly.graph_objects.Splom`.

:param (array) df: array of the data with column headers
:param (str) index: name of the index column in data array
:param (list|tuple) endpts: takes an increasing sequece of numbers
    that defines intervals on the real line. They are used to group
    the entries in an index of numbers into their corresponding
    interval and therefore can be treated as categorical data
:param (str) diag: sets the chart type for the main diagonal plots.
    The options are 'scatter', 'histogram' and 'box'.
:param (int|float) height: sets the height of the chart
:param (int|float) width: sets the width of the chart
:param (float) size: sets the marker size (in px)
:param (str) title: the title label of the scatterplot matrix
:param (str|tuple|list|dict) colormap: either a plotly scale name,
    an rgb or hex color, a color tuple, a list of colors or a
    dictionary. An rgb color is of the form 'rgb(x, y, z)' where
    x, y and 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 valid color types as its
    members.
    If colormap is a dictionary, all the string entries in
    the index column must be a key in colormap. In this case, the
    colormap_type is forced to 'cat' or categorical
:param (str) colormap_type: determines how colormap is interpreted.
    Valid choices are 'seq' (sequential) and 'cat' (categorical). If
    'seq' is selected, only the first two colors in colormap will be
    considered (when colormap is a list) and the index values will be
    linearly interpolated between those two colors. This option is
    forced if all index values are numeric.
    If 'cat' is selected, a color from colormap will be assigned to
    each category from index, including the intervals if endpts is
    being used
:param (dict) **kwargs: a dictionary of scatterplot arguments
    The only forbidden parameters are 'size', 'color' and
    'colorscale' in 'marker'

Example 1: Vanilla Scatterplot Matrix

>>> from plotly.graph_objs import graph_objs
>>> from plotly.figure_factory import create_scatterplotmatrix

>>> import numpy as np
>>> import pandas as pd

>>> # Create dataframe
>>> df = pd.DataFrame(np.random.randn(10, 2),
...                 columns=['Column 1', 'Column 2'])

>>> # Create scatterplot matrix
>>> fig = create_scatterplotmatrix(df)
>>> fig.show()


Example 2: Indexing a Column

>>> from plotly.graph_objs import graph_objs
>>> from plotly.figure_factory import create_scatterplotmatrix

>>> import numpy as np
>>> import pandas as pd

>>> # Create dataframe with index
>>> df = pd.DataFrame(np.random.randn(10, 2),
...                    columns=['A', 'B'])

>>> # Add another column of strings to the dataframe
>>> df['Fruit'] = pd.Series(['apple', 'apple', 'grape', 'apple', 'apple',
...                          'grape', 'pear', 'pear', 'apple', 'pear'])

>>> # Create scatterplot matrix
>>> fig = create_scatterplotmatrix(df, index='Fruit', size=10)
>>> fig.show()


Example 3: Styling the Diagonal Subplots

>>> from plotly.graph_objs import graph_objs
>>> from plotly.figure_factory import create_scatterplotmatrix

>>> import numpy as np
>>> import pandas as pd

>>> # Create dataframe with index
>>> df = pd.DataFrame(np.random.randn(10, 4),
...                    columns=['A', 'B', 'C', 'D'])

>>> # Add another column of strings to the dataframe
>>> df['Fruit'] = pd.Series(['apple', 'apple', 'grape', 'apple', 'apple',
...                          'grape', 'pear', 'pear', 'apple', 'pear'])

>>> # Create scatterplot matrix
>>> fig = create_scatterplotmatrix(df, diag='box', index='Fruit', height=1000,
...                                width=1000)
>>> fig.show()


Example 4: Use a Theme to Style the Subplots

>>> from plotly.graph_objs import graph_objs
>>> from plotly.figure_factory import create_scatterplotmatrix

>>> import numpy as np
>>> import pandas as pd

>>> # Create dataframe with random data
>>> df = pd.DataFrame(np.random.randn(100, 3),
...                    columns=['A', 'B', 'C'])

>>> # Create scatterplot matrix using a built-in
>>> # Plotly palette scale and indexing column 'A'
>>> fig = create_scatterplotmatrix(df, diag='histogram', index='A',
...                                colormap='Blues', height=800, width=800)
>>> fig.show()


Example 5: Example 4 with Interval Factoring

>>> from plotly.graph_objs import graph_objs
>>> from plotly.figure_factory import create_scatterplotmatrix

>>> import numpy as np
>>> import pandas as pd

>>> # Create dataframe with random data
>>> df = pd.DataFrame(np.random.randn(100, 3),
...                    columns=['A', 'B', 'C'])

>>> # Create scatterplot matrix using a list of 2 rgb tuples
>>> # and endpoints at -1, 0 and 1
>>> fig = create_scatterplotmatrix(df, diag='histogram', index='A',
...                                colormap=['rgb(140, 255, 50)',
...                                          'rgb(170, 60, 115)', '#6c4774',
...                                          (0.5, 0.1, 0.8)],
...                                endpts=[-1, 0, 1], height=800, width=800)
>>> fig.show()


Example 6: Using the colormap as a Dictionary

>>> from plotly.graph_objs import graph_objs
>>> from plotly.figure_factory import create_scatterplotmatrix

>>> import numpy as np
>>> import pandas as pd
>>> import random

>>> # Create dataframe with random data
>>> df = pd.DataFrame(np.random.randn(100, 3),
...                    columns=['Column A',
...                             'Column B',
...                             'Column C'])

>>> # Add new color column to dataframe
>>> new_column = []
>>> strange_colors = ['turquoise', 'limegreen', 'goldenrod']

>>> for j in range(100):
...     new_column.append(random.choice(strange_colors))
>>> df['Colors'] = pd.Series(new_column, index=df.index)

>>> # Create scatterplot matrix using a dictionary of hex color values
>>> # which correspond to actual color names in 'Colors' column
>>> fig = create_scatterplotmatrix(
...     df, diag='box', index='Colors',
...     colormap= dict(
...         turquoise = '#00F5FF',
...         limegreen = '#32CD32',
...         goldenrod = '#DAA520'
...     ),
...     colormap_type='cat',
...     height=800, width=800
... )
>>> fig.show()
rgb#zlIf 'colormap' is a string, it must be the name of a Plotly Colorscale. The available colorscale names are {}r   r   zXMake sure you set the index input variable to one of the column names of your dataframe.c              3   ,   >#    U  H	  oT;   v   M     g 7f)Nr5   )r6   rE   r~   s     r    r9   +create_scatterplotmatrix.<locals>.<genexpr>G  s     E*H,*s   zEIf colormap is a dictionary, all the names in the index must be keys.)rI   r   r`   r   validate_colors_dictr   PLOTLY_SCALESr|   r   r   r*   colorscale_to_colorsvalidate_colorsr   valuestolistr   validate_dataframerp   validate_indexallr   r   )rD   rE   r   rF   r[   r\   r1   rX   r~   rG   rc   rd   r}   r8   rR   figurekeys           `        r    create_scatterplotmatrixr   D  s   H 	
r$HH (D!!,,Xu=	Hc	"	"uH'<HAT4--2244((%vd&8&8&=&=&?@  001C1CH1MNH }~5H''%8''%8DNN4  DRX__3356  	  +F5
DJ
  ?((  Y%%,,.
D}t$  DRX__3356  	  +Z( h%%E*EEE$00(    & F M ' F Mr"   )NNr	     r      zScatterplot MatrixNr   NNN)plotlyr   r   plotly.colorscolorsr   plotly.figure_factoryr   plotly.graph_objsr   plotly.subplotsr   
get_moduler;   rA   rB   r!   r.   rI   rp   r   r   r   r5   r"   r    <module>r      s    /  ' ( )  *.u~ 2j7>B6rXv\B 	
	

kr"   