How can I plot a picture instead of "linespec" requirements?

조회 수: 10 (최근 30일)
Alexandra
Alexandra 2014년 12월 7일
편집: Henrik 2014년 12월 8일
For example,
instead of just running this code:
plot(x,y,'o');
with a plot of blue circles, I want to plot a picture of choice. I know how convert an image from a url with urlwrite command..Can I just put that as the 3rd parameter, or is there another line of code I need to do this? Thanks!
this is my entire code:
while true
dlg_prompts = {'Radius','delta_time','delta_theta'};
dlg_title = 'Calculate a Mass Moment of Inertia';
dlg_defaults = {'1','.01','3'};
opts.Resize = 'on'; % a structure
dlg_ans = inputdlg(dlg_prompts,dlg_title,1,dlg_defaults,opts)
r1 = str2num(dlg_ans{1})
dtime=str2num(dlg_ans{2})
dtheta=str2num(dlg_ans{3}')
axis([-2.*r1 2.*r1 -2.*r1 2.*r1])
title('Simulating Your Rotation')
hold on
for dtheta = [0:dtheta:360];
x = r1.*cosd(dtheta);
y=r1.*sind(dtheta);
%**url='http://www.girl.com.au/image.phpimagename=ballerinawiigame.jpg&imagetype=b';
%**img = imread(url);
%**plot(x,y,img) **NOT THE RIGHT COMMAND
pause(dtime)
end
quest = 'Would you like to go again?';
qtitle = 'Continue?';
a = { 'Absolutely', 'No Way!'};
resp = questdlg(quest,qtitle,a{1},a{2},a{1});
if resp == a{2}
h=msgbox(sprintf('Thanks for your time on this A++ Project!'));
waitfor(h);
break
end
end

답변 (1개)

Henrik
Henrik 2014년 12월 7일
편집: Henrik 2014년 12월 8일
If you want to plot a picture, then maybe surf or imagesc is the right command.
EDIT:
What is it exactly you want? Do you want the image to be used as a marker instead of circles? If so, then maybe this can help:
I found it by googling "matlab custom marker" - there seems to be more results that might be useful if this is indeed what you want.

카테고리

Help CenterFile Exchange에서 Lighting, Transparency, and Shading에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by