@@ -1455,8 +1455,10 @@ def _scatterplot(dataframe, headers,
1455
1455
height , width ,
1456
1456
title , ** kwargs ):
1457
1457
"""
1458
- Returns fig for scatterplotmatrix without index or theme.
1459
1458
Refer to FigureFactory.create_scatterplotmatrix() for docstring.
1459
+
1460
+ Returns fig for scatterplotmatrix without index or theme.
1461
+
1460
1462
"""
1461
1463
1462
1464
from plotly .graph_objs import graph_objs
@@ -1532,8 +1534,10 @@ def _scatterplot_index(dataframe, headers,
1532
1534
index , index_vals ,
1533
1535
** kwargs ):
1534
1536
"""
1535
- Returns fig for scatterplotmatrix with an index and no theme.
1536
1537
Refer to FigureFactory.create_scatterplotmatrix() for docstring.
1538
+
1539
+ Returns fig for scatterplotmatrix with an index and no theme.
1540
+
1537
1541
"""
1538
1542
from plotly .graph_objs import graph_objs
1539
1543
dim = len (dataframe )
@@ -1699,9 +1703,10 @@ def _scatterplot_theme(dataframe, headers, diag, size, height, width,
1699
1703
title , index , index_vals , endpts ,
1700
1704
palette , ** kwargs ):
1701
1705
"""
1702
- Returns fig for scatterplotmatrix with both index and theme.
1703
1706
Refer to FigureFactory.create_scatterplotmatrix() for docstring.
1704
1707
1708
+ Returns fig for scatterplotmatrix with both index and theme.
1709
+
1705
1710
:raises: (PlotlyError) If palette string is not a Plotly colorscale
1706
1711
:raises: (PlotlyError) If palette is not a string or list
1707
1712
"""
@@ -2263,7 +2268,7 @@ def _scatterplot_theme(dataframe, headers, diag, size, height, width,
2263
2268
@staticmethod
2264
2269
def _validate_index (index_vals ):
2265
2270
"""
2266
- Validates if a list contains all numbers or all strings.
2271
+ Validates if a list contains all numbers or all strings
2267
2272
2268
2273
:raises: (PlotlyError) If there are any two items in the list whose
2269
2274
types differ
@@ -2286,8 +2291,7 @@ def _validate_index(index_vals):
2286
2291
@staticmethod
2287
2292
def _validate_dataframe (array ):
2288
2293
"""
2289
- Validates if for the lists in a dataframe, they contain all numbers
2290
- or all strings.
2294
+ Validates all strings or numbers in each dataframe column
2291
2295
2292
2296
:raises: (PlotlyError) If there are any two items in any list whose
2293
2297
types differ
@@ -2357,6 +2361,8 @@ def _validate_scatterplotmatrix(df, index, diag, **kwargs):
2357
2361
@staticmethod
2358
2362
def _endpts_to_intervals (endpts ):
2359
2363
"""
2364
+ Returns a list of intervals for categorical colormaps
2365
+
2360
2366
Accepts a list or tuple of sequentially increasing numbers and returns
2361
2367
a list representation of the mathematical intervals with these numbers
2362
2368
as endpoints. For example, [1, 4, 6] returns [[1, 4], [4, 6]]
@@ -2402,6 +2408,8 @@ def _endpts_to_intervals(endpts):
2402
2408
@staticmethod
2403
2409
def _convert_to_RGB_255 (colors ):
2404
2410
"""
2411
+ Return a list of tuples where each element gets multiplied by 255
2412
+
2405
2413
Takes a list of color tuples where each element is between 0 and 1
2406
2414
and returns the same list where each tuple element is normalized to be
2407
2415
between 0 and 255
@@ -2414,32 +2422,38 @@ def _convert_to_RGB_255(colors):
2414
2422
return colors_255
2415
2423
2416
2424
@staticmethod
2417
- def _n_colors (tuple1 , tuple2 , n_colors ):
2425
+ def _n_colors (lowcolor , highcolor , n_colors ):
2418
2426
"""
2427
+ Splits a low and high color into a list of #n_colors colors
2428
+
2419
2429
Accepts two color tuples and returns a list of n_colors colors
2420
- which form the intermediate points between tuple1 and tuple2
2430
+ which form the intermediate colors between lowcolor and highcolor
2431
+
2421
2432
"""
2422
- diff_0 = float (tuple2 [0 ] - tuple1 [0 ])
2433
+ diff_0 = float (highcolor [0 ] - lowcolor [0 ])
2423
2434
incr_0 = diff_0 / (n_colors - 1 )
2424
- diff_1 = float (tuple2 [1 ] - tuple1 [1 ])
2435
+ diff_1 = float (highcolor [1 ] - lowcolor [1 ])
2425
2436
incr_1 = diff_1 / (n_colors - 1 )
2426
- diff_2 = float (tuple2 [2 ] - tuple1 [2 ])
2437
+ diff_2 = float (highcolor [2 ] - lowcolor [2 ])
2427
2438
incr_2 = diff_2 / (n_colors - 1 )
2428
2439
color_tuples = []
2429
2440
2430
2441
for index in range (n_colors ):
2431
- new_tuple = (tuple1 [0 ] + (index * incr_0 ),
2432
- tuple1 [1 ] + (index * incr_1 ),
2433
- tuple1 [2 ] + (index * incr_2 ))
2442
+ new_tuple = (lowcolor [0 ] + (index * incr_0 ),
2443
+ lowcolor [1 ] + (index * incr_1 ),
2444
+ lowcolor [2 ] + (index * incr_2 ))
2434
2445
color_tuples .append (new_tuple )
2435
2446
2436
2447
return color_tuples
2437
2448
2438
2449
@staticmethod
2439
2450
def _label_rgb (colors ):
2440
2451
"""
2452
+ Takes colors (a, b, c) and returns tuples 'rgb(a, b, c)'
2453
+
2441
2454
Takes a list of two color tuples of the form (a, b, c) and returns the
2442
2455
same list with each tuple replaced by a string 'rgb(a, b, c)'
2456
+
2443
2457
"""
2444
2458
colors_label = []
2445
2459
for color in colors :
@@ -2451,21 +2465,24 @@ def _label_rgb(colors):
2451
2465
@staticmethod
2452
2466
def _unlabel_rgb (colors ):
2453
2467
"""
2468
+ Takes rgb colors 'rgb(a, b, c)' and returns the tuples (a, b, c)
2469
+
2454
2470
This function takes a list of two 'rgb(a, b, c)' color strings and
2455
2471
returns a list of the color tuples in tuple form without the 'rgb'
2456
2472
label. In particular, the output is a list of two tuples of the form
2457
2473
(a, b, c)
2474
+
2458
2475
"""
2459
2476
unlabelled_colors = []
2460
- for color in colors :
2477
+ for character in colors :
2461
2478
str_vals = ''
2462
- for index in range (len (color )):
2479
+ for index in range (len (character )):
2463
2480
try :
2464
- float (color [index ])
2465
- str_vals = str_vals + color [index ]
2481
+ float (character [index ])
2482
+ str_vals = str_vals + character [index ]
2466
2483
except ValueError :
2467
- if (color [index ] == ',' ) or (color [index ] == '.' ):
2468
- str_vals = str_vals + color [index ]
2484
+ if (character [index ] == ',' ) or (character [index ] == '.' ):
2485
+ str_vals = str_vals + character [index ]
2469
2486
2470
2487
str_vals = str_vals + ','
2471
2488
numbers = []
0 commit comments