Better data tip for Polar graph
3 ビュー (過去 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!