How to show picture at specified relative position in a plot?

19 views (last 30 days)
Hello, by using the the "axes" and "imshow" command, it is possible to place a picture at a specified position in an existing figure / plot using. For example, see question + answer
However, the coordinates used by the "axes" command refer to the entire figure window. In my case, I want the picture displayed at positions which refer to the x / y axes of the main plot, i.e. (0, 0) shall not be the lower left corner of the figure, but the origin of xy coordinates of the plot.
Background: I am trying to built a work-around for a previous inquiry lnk Multiple (rotated) histograms in one xy plot. I have created multiple pictures (= identically scaled and rotated histograms), now I want show them "stacked": Their baseline should be at specified x coordinates of the xy-plot (e.g. x=1, x=2, x=3)
Thanks in advance for any input, Dan
  1 Comment
jonas
jonas on 10 Sep 2018
Edited: jonas on 10 Sep 2018
It's possible. You just need to convert the axes1 position to figure position. Fairly easy to do this from scratch, but I recall seeing a FEX function for this... I'll see if I can find it
EDIT: this is the one I was thinking about

Sign in to comment.

Answers (1)

DGM
DGM on 22 Mar 2023
To insert an image does not require an overlaid axes. You can do it as in this example:
That said, using an overlaid axes might be desirable if you wanted the inserted histograms to actually be histogram objects instead of static screenshots.

Products


Release

R2018a

Community Treasure Hunt

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

Start Hunting!