How can I plot a picture instead of "linespec" requirements?
1 次查看(过去 30 天)
显示 更早的评论
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
0 个评论
回答(1 个)
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.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Graphics Performance 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!