How to Place an image over existing plots?

621 views (last 30 days)
Ashley
Ashley on 18 Dec 2014
Commented: Dardag on 29 Jul 2020
Hello, I have some graphs in Matlab over which I want to insert a small image. I do not want to cover the graphs completely, and want to know how to specify the exact position for overlaying this image onto the existing plots. I have used imread to read the file, but cannot seem to figure out imshow to display the image properly where I would like it to be.

Accepted Answer

Chad Greene
Chad Greene on 18 Dec 2014
Hi Ashley,
Run this:
figure
plot((1:10).^2)
axes('pos',[.1 .6 .5 .3])
imshow('coins.png')
The axes command sets up a new set of axes on top of the x^2 plot, with the position of those axes as follows:
[bottomleftcornerXposition bottomleftcornerYposition width height]
  4 Comments
Dardag
Dardag on 29 Jul 2020
I am inserting a particular image in my figure but the resolution of the inserted image gets distorted if I create a smaller box for that, why would that be?
This is what I am using but I don't see any resolution options.
[img, map, alphachannel] = imread(fileName,'png');
image(img, 'AlphaData', alphachannel);

Sign in to comment.

More Answers (1)

Philip Conteh
Philip Conteh on 2 Dec 2018
Hi,
Please help recommend me a code to plot an aircraft altitude and axis in a graph.

Categories

Community Treasure Hunt

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

Start Hunting!

Translated by