Trarbish
Trarbish

Reputation: 371

Customizing Data Cursor marker Matlab

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.

Upvotes: 2

Views: 3171

Answers (3)

Shaik Althaf
Shaik Althaf

Reputation: 11

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');

Upvotes: 1

Will
Will

Reputation: 1880

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

Upvotes: 1

Karthick Rajan
Karthick Rajan

Reputation: 396

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);

Upvotes: 0

Related Questions