File tree 1 file changed +14
-9
lines changed
1 file changed +14
-9
lines changed Original file line number Diff line number Diff line change @@ -1491,27 +1491,32 @@ def _make_colorscale(colors, scale=None):
1491
1491
colorscale = []
1492
1492
1493
1493
if not scale :
1494
- for j in range ( len ( colors ) ):
1495
- colorscale .append ([j * 1. / (len (colors ) - 1 ), colors [ j ] ])
1494
+ for j , color in enumerate ( colors ):
1495
+ colorscale .append ([j * 1. / (len (colors ) - 1 ), color ])
1496
1496
return colorscale
1497
1497
1498
1498
else :
1499
- colorscale = [[ scale [ j ], colors [ j ]] for j in range ( len ( colors ) )]
1499
+ colorscale = [list ( tup ) for tup in zip ( scale , colors )]
1500
1500
return colorscale
1501
1501
1502
1502
@staticmethod
1503
1503
def _convert_colorscale_to_rgb (colorscale ):
1504
1504
"""
1505
1505
Converts the colors in a colorscale to rgb colors
1506
+
1507
+ A colorscale is an array of arrays, each with a numeric value as the
1508
+ first item and a color as the second. This function specifically is
1509
+ converting a colorscale with tuple colors (each coordinate between 0
1510
+ and 1) into a colorscale with the colors transformed into rgb colors
1506
1511
"""
1507
- for index in range ( len ( colorscale )) :
1508
- colorscale [ index ] [1 ] = FigureFactory ._convert_to_RGB_255 (
1509
- colorscale [ index ] [1 ]
1512
+ for color in colorscale :
1513
+ color [1 ] = FigureFactory ._convert_to_RGB_255 (
1514
+ color [1 ]
1510
1515
)
1511
1516
1512
- for index in range ( len ( colorscale )) :
1513
- colorscale [ index ] [1 ] = FigureFactory ._label_rgb (
1514
- colorscale [ index ] [1 ]
1517
+ for color in colorscale :
1518
+ color [1 ] = FigureFactory ._label_rgb (
1519
+ color [1 ]
1515
1520
)
1516
1521
return colorscale
1517
1522
You can’t perform that action at this time.
0 commit comments