Better data tip for Polar graph
Afficher commentaires plus anciens
Is there any way to make Matlab give polar coordinates when placing a data tip on a graph instead of Cartesian?
And really, why on earth does Matlab not do that in the first place?
Réponses (3)
Oleg Komarov
le 8 Août 2011
0 votes
At the end of the documentation of datacursormode you will find example on how to customze the text of the tip.
George Sterling
le 12 Mai 2016
Modifié(e) : George Sterling
le 12 Mai 2016
0 votes
% This function changes data tips from cartessian to polar coords
function polar_datacursormode
dcm_obj = datacursormode(gcf); set(dcm_obj,'UpdateFcn',@myupdatefcn)
function txt = myupdatefcn(empt,event_obj) % Customizes text of data tips
pos = get(event_obj,'Position');
R = sqrt(pos(1)^2 + pos(2)^2);
Theta = atand(pos(2)/pos(1));
if Theta < 0 Theta = Theta + 360; end
txt = {['R: ' num2str®], ... ['Theta: ' num2str(Theta)]};
Mike Garrity
le 12 Mai 2016
0 votes

Catégories
En savoir plus sur Polar Plots dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!