How do I change the data cursor size, colour and shape?

25 vues (au cours des 30 derniers jours)
James Kempton
James Kempton le 14 Oct 2019
Commenté : Neda le 19 Août 2025
I am trying to change the data cursor size, colour and shape using the following code.
fig=gcf;
dcm_obj = datacursormode(fig);
set(dcm_obj,'enable','on','UpdateFcn',@data_tips)
hTarget = handle(fig);
hDatatip = cursorMode.createDatatip(hTarget);
set(hDatatip, 'MarkerSize',5, 'MarkerFaceColor','none', ...
'MarkerEdgeColor','k', 'Marker','o','HitTest','off');
However, I receive the following error:
Undefined variable "cursorMode" or class "cursorMode.createDatatip".
Error in figure_plotter (line 10)
hDatatip = cursorMode.createDatatip(hTarget);
Can anyone advise on the answer to my question, particularly by modifying the above code?

Réponse acceptée

Vahila Kayithi
Vahila Kayithi le 26 Déc 2019
You can change the properties of Data Cursor using the following commands:
alldatacursors = findall(gcf, 'type', 'hggroup', '-property', 'FontSize');
set(alldatacursors,'FontSize',12);
set(alldatacursors,'FontName','Times');
set(alldatacursors, 'FontWeight', 'bold');
For more information, refer to this link:
  3 commentaires
Veronica Ati
Veronica Ati le 7 Juin 2020
Thanks u
Neda
Neda le 19 Août 2025
Would you please clarify where I should put these command in my script? I put them before and after "figure" in the script but it did not work.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Graphics Object Programming dans Help Center et File Exchange

Produits


Version

R2017b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by