how to plot axes onto an image

8 ビュー (過去 30 日間)
vega valentine
vega valentine 2011 年 4 月 11 日
コメント済み: Tyler 2016 年 12 月 18 日
Hi,
I have a binary image, a set of contour points, and the coordinate of center of gravity. I want to plot an axis with the origin (0,0) set to the center of gravity. And the axes should be in polar coordinate since I want to have the angle in which the contour points with maximum radius exists.
Can anyone help me with this problem? thanks before
Regards, Vga

回答 (2 件)

Sarah Wait Zaranek
Sarah Wait Zaranek 2011 年 4 月 21 日
This should help you to start with the problem. Everything is centered at the origin (0,0) but that could be adjusted by changing the position values.
% generating random "image" data
a = rand(100,100);
% initial axis
h = axes('position',[0 0 1 1]);
colormap bone
%plotting image
f1 = imagesc(a);
% add axis
h2 = axes('position',[0 0 1 1]);
t = 0:.01:2*pi;
% make polar plot
f2 = polar(h2,t,sin(2*t).*cos(2*t),'r');
% removing background of polar plot - so image shows through
ph=findall(h2,'type','patch');
set(ph,'FaceColor','none')
  1 件のコメント
Tyler
Tyler 2016 年 12 月 18 日
hi, your answer is really helpful! but i want to plot(scatter) some points over an image, in a new axis, but the background of the new axis is white, so i can't see the image, Can you help me with this problem? thank you !!!

サインインしてコメントする。


Philip
Philip 2012 年 3 月 8 日
Just what I needed!

カテゴリ

Help Center および File ExchangeAnnotations についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by