|
46 | 46 | 'Blackbody': ['rgb(0,0,0)', 'rgb(160,200,255)'],
|
47 | 47 | 'Earth': ['rgb(0,0,130)', 'rgb(255,255,255)'],
|
48 | 48 | 'Electric': ['rgb(0,0,0)', 'rgb(255,250,220)'],
|
49 |
| - 'Viridis': ['rgb(68,1,84)', 'rgb(253,231,37)']} |
| 49 | + 'Viridis': 'Viridis'} |
| 50 | +#['rgb(68,1,84)', 'rgb(253,231,37)']} |
50 | 51 |
|
51 | 52 | # color constants for violin plot
|
52 | 53 | DEFAULT_FILLCOLOR = '#1f77b4'
|
@@ -1476,6 +1477,21 @@ class FigureFactory(object):
|
1476 | 1477 | more information and examples of a specific chart type.
|
1477 | 1478 | """
|
1478 | 1479 |
|
| 1480 | + @staticmethod |
| 1481 | + def _make_colorscale(colors): |
| 1482 | + """ |
| 1483 | + Makes a list of colors into a colorscale-acceptable form |
| 1484 | +
|
| 1485 | + For documentation regarding to the form of the output, see |
| 1486 | + https://plot.ly/python/reference/#mesh3d-colorscale |
| 1487 | + """ |
| 1488 | + colorscale = [] |
| 1489 | + diff = 1./(len(colors) - 1) |
| 1490 | + |
| 1491 | + for j in range(len(colors)): |
| 1492 | + colorscale.append([j * diff, colors[j]]) |
| 1493 | + return colorscale |
| 1494 | + |
1479 | 1495 | @staticmethod
|
1480 | 1496 | def _validate_gantt(df):
|
1481 | 1497 | """
|
@@ -3134,16 +3150,21 @@ def _trisurf(x, y, z, simplices, colormap=None, color_func=None,
|
3134 | 3150 | ii, jj, kk = simplices.T
|
3135 | 3151 |
|
3136 | 3152 | # Adding intensity to Mesh3D Data
|
3137 |
| - intensity = [j for j in range(len(x))] |
| 3153 | + intensity = [0] |
| 3154 | + |
| 3155 | + div = 1./(len(x) - 1) |
| 3156 | + |
| 3157 | + for j in range(1, len(x)+1): |
| 3158 | + intensity.append(j * div) |
| 3159 | + #print intensity |
| 3160 | + #intensity = [0 for j in range(len(x))] |
3138 | 3161 |
|
3139 |
| - colorscale_numbered = FigureFactory._make |
| 3162 | + colorscale_numbered = FigureFactory._make_colorscale(colormap) |
3140 | 3163 |
|
3141 | 3164 | triangles = graph_objs.Mesh3d(x=x, y=y, z=z, facecolor=facecolor,
|
3142 | 3165 | i=ii, j=jj, k=kk, name='',
|
3143 | 3166 | intensity=intensity,
|
3144 |
| - colorscale=[[0, 'rgb(255, 0, 0)'], |
3145 |
| - [0.5, 'rgb(0, 255, 0)'], |
3146 |
| - [1, 'rgb(0, 0, 255)']], |
| 3167 | + colorscale=colorscale_numbered, |
3147 | 3168 | showscale=True)
|
3148 | 3169 |
|
3149 | 3170 | if plot_edges is not True: # the triangle sides are not plotted
|
|
0 commit comments