Customizing Data Cursor marker Matlab
Asked Answered
M

3

2

Is there any possibility to change marker form and size for data cursor in Matlab? I mean it is black and square by default. I would like to change it to blue and circle, for example.
I've found only how to customize text of data tips.

Thank you.

Minorite answered 13/4, 2015 at 7:37 Comment(0)
P
1

Yes - marker options are included in the properties of the undocumented graphics.datatip object class.

These objects are accessible as hidden properties of the graphics.datacursormanager objects accessible through the documented datacursormode function. The .DataCursors property contains an array of these objects for each Data Cursor in the figure and .CurrentDataCursor property contains the object for the current one.

To take your example, to change the marker for the current Data Cursor of the current figure to a blue circle, you can do as follows:

dcm_obj = datacursormode(gcf);
set(dcm_obj.CurrentDataCursor, 'Marker','o', 'MarkerFaceColor','b');

More detailed information about the undocumented functionality can be found at http://undocumentedmatlab.com/blog/controlling-plot-data-tips

Preparedness answered 30/4, 2015 at 14:38 Comment(0)
P
1

Hope this helps..... For white background and classic look....

  • alldatacursors = findall(gcf,'type','hggroup')
  • set(alldatacursors,'FontSize',11)

  • set(alldatacursors,'FontName','Times')

  • set(alldatacursors,'BackgroundColor','w');

Polychaete answered 31/10, 2017 at 14:8 Comment(0)
D
0

yes it is possible by set Pointer property of figure to custom and then set the value for PointerShapeCData as per your choice but you can't change to RGB color format. Because PointerShapeCData property accept value 1 and 2. value 1 means black and 2 means white.

for example :

a = zeros(16,16);   % create matrix with size of 16 X 16 with value zero
a(:,:) = 1;         % assign all element value of matrix a to 1.
figure('Pointer','custom ','PointerShapeCData',a); 

% change some element value of a variable as 2 for change black to white.

a(:,1) = 2;         
 a(:,3) = 2;
 a(:,7) = 2;
 figure('Pointer','custom ','PointerShapeCData',a);
Decorum answered 13/4, 2015 at 7:42 Comment(2)
Could you please write some code to demonstrate it?Minorite
The question is about data cursors. The Pointer property affects the mouse cursor displayed when the pointer is hovering over the figure.Preparedness

© 2022 - 2024 — McMap. All rights reserved.