How can I plot a picture instead of "linespec" requirements?
1 view (last 30 days)
Show older comments
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 Comments
Answers (1)
Henrik
on 7 Dec 2014
Edited: Henrik
on 8 Dec 2014
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 Comments
See Also
Categories
Find more on Graphics Performance in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!