@@ -285,8 +285,7 @@ def _nested_color_boxplot(plt_data_list_of_lists, colormap,
285
285
plaquette_boundary_lines .append (dict (type = "line" , xref = 'paper' , yref = 'y' , x0 = 0 , y0 = y_bnd , x1 = 1 , y1 = y_bnd ,
286
286
line = {'color' :"#616263" , 'width' :1 , 'dash' :"solid" }))
287
287
288
- for bnd_line in plaquette_boundary_lines :
289
- fig .plotlyfig .add_shape (bnd_line )
288
+ fig .plotlyfig .update_layout (shapes = plaquette_boundary_lines )
290
289
#Add grid lines between the squares within a plaquette
291
290
#Can use a construction similar to the x/y boundary one to
292
291
#get some reference points, but we need to include the endpoints here.
@@ -331,14 +330,10 @@ def _nested_color_boxplot(plt_data_list_of_lists, colormap,
331
330
plaquette_grid_lines = []
332
331
for y in y_pos_filtered :
333
332
for endpoints in x_endpoints :
334
- #fig.plotlyfig.add_shape(type="line", x0=endpoints[0], y0=y, x1=endpoints[1], y1=y,
335
- # line={'color':"MediumPurple", 'width':.25, 'dash':"dot"})
336
333
plaquette_grid_lines .append (dict (type = "line" , x0 = endpoints [0 ], y0 = y , x1 = endpoints [1 ], y1 = y ,
337
334
line = {'color' :"MediumPurple" , 'width' :.35 , 'dash' :"1px" }))
338
335
for x in x_pos_filtered :
339
336
for endpoints in y_endpoints :
340
- #fig.plotlyfig.add_shape(type="line", x0=x, y0=endpoints[0], x1=x, y1=endpoints[1],
341
- # line={'color':"MediumPurple", 'width':.25, 'dash':"dot"})
342
337
plaquette_grid_lines .append (dict (type = "line" , x0 = x , y0 = endpoints [0 ], x1 = x , y1 = endpoints [1 ],
343
338
line = {'color' :"MediumPurple" , 'width' :.35 , 'dash' :"1px" }))
344
339
@@ -362,11 +357,18 @@ def _nested_color_boxplot(plt_data_list_of_lists, colormap,
362
357
clicktoshow = 'onout' , xclick = i , yclick = j ,
363
358
xshift = 20 ,
364
359
visible = False , font = dict (size = 12 , family = 'monospace' ),
365
- showarrow = False ))
360
+ showarrow = True ))
361
+ on_click_annotations .append (dict (x = i , y = j ,
362
+ yanchor = 'middle' , xanchor = 'center' ,
363
+ bordercolor = 'purple' , borderwidth = 0 ,
364
+ clicktoshow = 'onout' ,
365
+ text = '' , #border pad value is a complete guess...
366
+ visible = False , font = dict (size = 12 , family = 'monospace' ),
367
+ showarrow = True , arrowhead = 3 ))
366
368
#need to add these annotation to the layout here to have them properly work by default with the
367
369
#button menu. (otherwise you need to toggle the button off and on again before they appear).
368
370
fig .plotlyfig .update_layout (annotations = on_click_annotations )
369
-
371
+
370
372
#create a pair of buttons for toggling on and off the inner grids:
371
373
grid_button = dict (type = "buttons" ,
372
374
active = 1 ,
@@ -668,22 +670,18 @@ def hover_label_fn(val, i, j, ii, jj):
668
670
669
671
#decide on some absolute distances (in pixels?) between the buttons and the bottom of the printable area.
670
672
y_abs_0 = 25
671
- y_abs_1 = 65
673
+ y_abs_1 = 75
672
674
#vertical plotting area should be (approximately at least) height - tmargin - bmargin
673
675
plottable_height = height - tmargin - bmargin
674
676
new_y_0 = - y_abs_0 / plottable_height
675
677
new_y_1 = - y_abs_1 / plottable_height
676
678
#Now let's update the updatemenus
677
- new_updatemenus = list (pfig .layout .updatemenus )
678
- #The first entry is the grid button, the second the hover button, and the third the clickable element button.
679
- #the last of these needs an additional vertical shift added.
680
- new_updatemenus [0 ].y = new_y_0
681
- new_updatemenus [1 ].y = new_y_0
682
- new_updatemenus [2 ].y = new_y_1
683
-
684
- #now let's update the updatemenus in the figure.
685
- pfig .update_layout (updatemenus = new_updatemenus )
686
-
679
+ #updatemenus should be a tuple, but for some reason this looks like
680
+ #it works...
681
+ pfig ['layout' ]['updatemenus' ][0 ]['y' ] = new_y_0
682
+ pfig ['layout' ]['updatemenus' ][1 ]['y' ] = new_y_0
683
+ pfig ['layout' ]['updatemenus' ][2 ]['y' ] = new_y_1
684
+
687
685
else : # fig is None => use a "No data to display" placeholder figure
688
686
trace = go .Heatmap (z = _np .zeros ((10 , 10 ), 'd' ),
689
687
colorscale = [[0 , 'white' ], [1 , 'black' ]],
0 commit comments