How to insert image in MatLab
681 views (last 30 days)
Show older comments
I want to insert an image at (0,0) on a plot. How would I do this and how can I determine the size? And also do I need to convert the image to a png?
Thanks!
0 Comments
Answers (4)
Jakub Rysanek
on 4 Oct 2016
imread() can import whole bunch of graphical data types, including .jpg and .png. Conversion to .png, as you ask, is not necessary.
img = imread('filename.png');
image(img);
To alter the size/positioning of the image within your figure, you can touch the underlying axes object:
x = 0;
y = 0;
width = 0.5;% measured relative to the figure width
height = 0.5;% measured relative to the figure height
set(gca,'units','normalized','position',[x y width height])
0 Comments
Dada D
on 7 Oct 2021
x = 0; y = 0; width = 0.5;% measured relative to the figure width height = 0.5;% measured relative to the figure height set(gca,'units','normalized','position',[x y width height])
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!