File tree 2 files changed +22
-6
lines changed
example_cursor_scatter_experimental
kivy_matplotlib_widget/uix
2 files changed +22
-6
lines changed Original file line number Diff line number Diff line change @@ -397,14 +397,22 @@ def hover(self, event) -> None:
397
397
if self .multi_xdata :
398
398
self .hover_instance .custom_label = self .scatter_label [good_index2_scatter [idx_best ]]
399
399
else :
400
- self .hover_instance .custom_label = line . get_label ()
400
+ self .hover_instance .custom_label = self . scatter_label [ good_index_scatter [ idx_best ]]
401
401
if line :
402
402
self .hover_instance .custom_color = get_color_from_hex (to_hex (line .get_color ()))
403
403
elif scatter :
404
404
if self .multi_xdata :
405
- self .hover_instance .custom_color = get_color_from_hex (to_hex (scatter .get_facecolors ()))
405
+ if len (self .x_cursor )== len (scatter .get_facecolors ()):
406
+ color = scatter .get_facecolors ()[good_index2_scatter [idx_best ]]
407
+ else :
408
+ color = scatter .get_facecolors ()
409
+ self .hover_instance .custom_color = get_color_from_hex (to_hex (color ))
406
410
else :
407
- self .hover_instance .custom_color = get_color_from_hex (to_hex (scatter .get_facecolors ()))
411
+ if len (self .x_cursor )== len (scatter .get_facecolors ()):
412
+ color = scatter .get_facecolors ()[good_index_scatter [idx_best ]]
413
+ else :
414
+ color = scatter .get_facecolors ()
415
+ self .hover_instance .custom_color = get_color_from_hex (to_hex (color ))
408
416
409
417
if self .hover_instance .x_hover_pos > self .x + self .axes .bbox .bounds [2 ] + self .axes .bbox .bounds [0 ] or \
410
418
self .hover_instance .x_hover_pos < self .x + self .axes .bbox .bounds [0 ] or \
Original file line number Diff line number Diff line change @@ -397,14 +397,22 @@ def hover(self, event) -> None:
397
397
if self .multi_xdata :
398
398
self .hover_instance .custom_label = self .scatter_label [good_index2_scatter [idx_best ]]
399
399
else :
400
- self .hover_instance .custom_label = line . get_label ()
400
+ self .hover_instance .custom_label = self . scatter_label [ good_index_scatter [ idx_best ]]
401
401
if line :
402
402
self .hover_instance .custom_color = get_color_from_hex (to_hex (line .get_color ()))
403
403
elif scatter :
404
404
if self .multi_xdata :
405
- self .hover_instance .custom_color = get_color_from_hex (to_hex (scatter .get_facecolors ()))
405
+ if len (self .x_cursor )== len (scatter .get_facecolors ()):
406
+ color = scatter .get_facecolors ()[good_index2_scatter [idx_best ]]
407
+ else :
408
+ color = scatter .get_facecolors ()
409
+ self .hover_instance .custom_color = get_color_from_hex (to_hex (color ))
406
410
else :
407
- self .hover_instance .custom_color = get_color_from_hex (to_hex (scatter .get_facecolors ()))
411
+ if len (self .x_cursor )== len (scatter .get_facecolors ()):
412
+ color = scatter .get_facecolors ()[good_index_scatter [idx_best ]]
413
+ else :
414
+ color = scatter .get_facecolors ()
415
+ self .hover_instance .custom_color = get_color_from_hex (to_hex (color ))
408
416
409
417
if self .hover_instance .x_hover_pos > self .x + self .axes .bbox .bounds [2 ] + self .axes .bbox .bounds [0 ] or \
410
418
self .hover_instance .x_hover_pos < self .x + self .axes .bbox .bounds [0 ] or \
You can’t perform that action at this time.
0 commit comments