Better data tip for Polar graph
6 次查看(过去 30 天)
显示 更早的评论
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?
0 个评论
回答(3 个)
Oleg Komarov
2011-8-8
At the end of the documentation of datacursormode you will find example on how to customze the text of the tip.
0 个评论
George Sterling
2016-5-12
编辑:George Sterling
2016-5-12
% 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)]};
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Polar Plots 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!