Better data tip for Polar graph

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?

답변 (3개)

Oleg Komarov
Oleg Komarov 2011년 8월 8일

0 개 추천

At the end of the documentation of datacursormode you will find example on how to customze the text of the tip.
George Sterling
George Sterling 2016년 5월 12일
편집: George Sterling 2016년 5월 12일

0 개 추천

% 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
Mike Garrity 2016년 5월 12일

0 개 추천

The new polarplot function in R2016a does this for you.

카테고리

도움말 센터File Exchange에서 Polar Plots에 대해 자세히 알아보기

제품

태그

질문:

2011년 8월 7일

답변:

2016년 5월 12일

Community Treasure Hunt

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

Start Hunting!

Translated by