@@ -3269,9 +3269,9 @@ def _map_face2color(face, colormap, vmin, vmax):
32693269        return  face_color 
32703270
32713271    @staticmethod  
3272-     def  _trisurf (x , y , z , simplices , show_colorbar , colormap = None ,
3273-                  color_func = None , plot_edges = False ,  x_edge = None , y_edge = None ,
3274-                  z_edge = None , facecolor = None ):
3272+     def  _trisurf (x , y , z , simplices , show_colorbar , edges_color ,
3273+                  colormap = None , color_func = None , plot_edges = False ,
3274+                  x_edge = None ,  y_edge = None ,  z_edge = None , facecolor = None ):
32753275        """ 
32763276        Refer to FigureFactory.create_trisurf() for docstring 
32773277        """ 
@@ -3305,7 +3305,7 @@ def _trisurf(x, y, z, simplices, show_colorbar, colormap=None,
33053305                        color_func [index ] =  FigureFactory ._label_rgb (foo )
33063306
33073307            mean_dists  =  np .asarray (color_func )
3308-         else :
3308+         elif   hasattr ( color_func ,  '__call__' ) :
33093309            # apply user inputted function to calculate 
33103310            # custom coloring for triangle vertices 
33113311            mean_dists  =  []
@@ -3333,30 +3333,39 @@ def _trisurf(x, y, z, simplices, show_colorbar, colormap=None,
33333333                                                      max_mean_dists )
33343334                facecolor .append (color )
33353335
3336-         # Make sure we have arrays to speed up plotting  
3336+         # Make sure facecolor is a list so output is consistent across Pythons  
33373337        facecolor  =  list (facecolor )
33383338        ii , jj , kk  =  simplices .T 
33393339
3340-         # make a colorscale from the colors 
3341-         colorscale  =  FigureFactory ._make_colorscale (colormap )
3342-         colorscale  =  FigureFactory ._convert_colorscale_to_rgb (colorscale )
3343- 
33443340        triangles  =  graph_objs .Mesh3d (x = x , y = y , z = z , facecolor = facecolor ,
33453341                                      i = ii , j = jj , k = kk , name = '' )
33463342
3347-         colorbar  =  graph_objs .Mesh3d (x = [0 , 1 ], y = [0 , 1 ], z = [0 , 1 ],
3348-                                      colorscale = colorscale ,
3349-                                      intensity = [0 , 1 ],
3350-                                      showscale = True )
3343+         if  not  isinstance (mean_dists [0 ], str ) and  show_colorbar  is  True :
3344+             # make a colorscale from the colors 
3345+             colorscale  =  FigureFactory ._make_colorscale (colormap )
3346+             colorscale  =  FigureFactory ._convert_colorscale_to_rgb (colorscale )
3347+ 
3348+             colorbar  =  graph_objs .Scatter3d (
3349+                 x = x [:2 ],
3350+                 y = y [:2 ],
3351+                 z = z [:2 ],
3352+                 mode = 'markers' ,
3353+                 marker = dict (
3354+                     size = 0.1 ,
3355+                     color = [min_mean_dists , max_mean_dists ],
3356+                     colorscale = colorscale ,
3357+                     showscale = True ),
3358+                 hoverinfo = 'None' ,
3359+                 showlegend = False 
3360+             )
33513361
33523362        # the triangle sides are not plotted 
3353-         if  plot_edges  is  not   True :
3354-             if  show_colorbar  is  True :
3363+         if  plot_edges  is  False :
3364+             if  not   isinstance ( mean_dists [ 0 ],  str )  and   show_colorbar  is  True :
33553365                return  graph_objs .Data ([triangles , colorbar ])
33563366            else :
33573367                return  graph_objs .Data ([triangles ])
33583368
3359- 
33603369        # define the lists x_edge, y_edge and z_edge, of x, y, resp z 
33613370        # coordinates of edge end points for each triangle 
33623371        # None separates data corresponding to two consecutive triangles 
@@ -3392,10 +3401,14 @@ def _trisurf(x, y, z, simplices, show_colorbar, colormap=None,
33923401        # define the lines for plotting 
33933402        lines  =  graph_objs .Scatter3d (
33943403            x = x_edge , y = y_edge , z = z_edge , mode = 'lines' ,
3395-             line = graph_objs .Line (color = 'rgb(50, 50, 50)' ,
3396-                                  width = 1.5 )
3404+             line = graph_objs .Line (
3405+                 color = edges_color ,
3406+                 width = 1.5 
3407+             ),
3408+             showlegend = False 
33973409        )
3398-         if  show_colorbar  is  True :
3410+ 
3411+         if  not  isinstance (mean_dists [0 ], str ) and  show_colorbar  is  True :
33993412            return  graph_objs .Data ([triangles , lines , colorbar ])
34003413        else :
34013414            return  graph_objs .Data ([triangles , lines ])
@@ -3407,6 +3420,7 @@ def create_trisurf(x, y, z, simplices, colormap=None, show_colorbar=True,
34073420                       backgroundcolor = 'rgb(230, 230, 230)' ,
34083421                       gridcolor = 'rgb(255, 255, 255)' ,
34093422                       zerolinecolor = 'rgb(255, 255, 255)' ,
3423+                        edges_color = 'rgb(50, 50, 50)' ,
34103424                       height = 800 , width = 800 ,
34113425                       aspectratio = dict (x = 1 , y = 1 , z = 1 )):
34123426        """ 
@@ -3440,6 +3454,7 @@ def create_trisurf(x, y, z, simplices, colormap=None, show_colorbar=True,
34403454            inclusive 
34413455        :param (str) zerolinecolor: color of the axes. Takes a string of the 
34423456            form 'rgb(x,y,z)' x,y,z are between 0 and 255 inclusive 
3457+         :param (str) edges_color: color of the edges, if plot_edges is True 
34433458        :param (int|float) height: the height of the plot (in pixels) 
34443459        :param (int|float) width: the width of the plot (in pixels) 
34453460        :param (dict) aspectratio: a dictionary of the aspect ratio values for 
@@ -3622,6 +3637,7 @@ def dist_origin(x, y, z):
36223637            x, y, z, simplices, 
36233638            color_func=colors, 
36243639            show_colorbar=True, 
3640+             edges_color='rgb(2,85,180)', 
36253641            title=' Modern Art' 
36263642        ) 
36273643
@@ -3637,6 +3653,7 @@ def dist_origin(x, y, z):
36373653                                       show_colorbar = show_colorbar ,
36383654                                       color_func = color_func ,
36393655                                       colormap = colormap ,
3656+                                        edges_color = edges_color ,
36403657                                       plot_edges = plot_edges )
36413658        axis  =  dict (
36423659            showbackground = showbackground ,
0 commit comments