Add image into figure outside of plot axes

18 ビュー (過去 30 日間)
Konvictus177
Konvictus177 2022 年 5 月 28 日
コメント済み: Voss 2022 年 5 月 29 日
Hi,
How can I plot a graph in a figure and add an image outside the axes.
For example I want to add a descriptional image here in the blue box.
Thanks.

採用された回答

Voss
Voss 2022 年 5 月 28 日
編集済み: Voss 2022 年 5 月 28 日
If your axes limits are fixed, then you could make an image in the same axes, place it outside the axes limits and turn Clipping off so it shows up:
figure();
plot(1:10)
xlim([1 10])
ylim([1 10])
image(gca(),'XData',[-0.5 0.5],'YData',[10 8],'Clipping','off');
On the other hand, if your axes limits may change and you want the image to remain fixed, then it'll be better to make a second axes for the image:
figure();
plot(1:10)
ax2 = axes( ...
'Units','normalized', ...
'Position',[0 0.7 0.1 0.2], ...
'YDir','reverse', ...
'Visible','off');
image(ax2)
  2 件のコメント
Konvictus177
Konvictus177 2022 年 5 月 29 日
Thanks!
Voss
Voss 2022 年 5 月 29 日
You're welcome!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCreating, Deleting, and Querying Graphics Objects についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by