Change the size 2 uiaxes

2 ビュー (過去 30 日間)
Ely Raz
Ely Raz 2023 年 10 月 18 日
編集済み: Dyuman Joshi 2023 年 10 月 18 日
How can I change the size 2 uiaxes (ax by -50% and ax1 by 50%)?
Code:
fig = uifigure;
ax = uiaxes(fig,'Position',[10 10 250 400]);
x = linspace(-pi,pi);
y = sin(x);
plot(ax,x,y)
ax1 = uiaxes(fig,'Position',[300 10 250 400]);
imshow('cameraman.tif','Parent',ax1)

回答 (1 件)

Dyuman Joshi
Dyuman Joshi 2023 年 10 月 18 日
編集済み: Dyuman Joshi 2023 年 10 月 18 日
Experiment with the position values and see which values gives you the best/preferred output. I have posted the values I have tried -
fig = uifigure;
%Get the position of the uifigure
pos = fig.Position;
Note that the values for the position of uifigure are from the bottom left corner of the primary display (i.e. your screen). Maximizing/minimizing the figure changes the position values as well.
ax = uiaxes(fig,'Position',[10 pos(2)/2 125 200]);
x = linspace(-pi,pi);
y = sin(x);
plot(ax,x,y)
ax1 = uiaxes(fig,'Position',[pos(1)/2+10 10 400 400]);
imshow('cameraman.tif','Parent',ax1)
  2 件のコメント
Ely Raz
Ely Raz 2023 年 10 月 18 日
I get this error
Unrecognized function or variable 'pos'.
Error in untitled (line 5)
pos = uiaxes(fig,'Position',[10 pos(2)/2 125 200]);
Dyuman Joshi
Dyuman Joshi 2023 年 10 月 18 日
編集済み: Dyuman Joshi 2023 年 10 月 18 日
@Ely Raz Sorry, I mixed up a few things while copy and pasting. I have corrected the code, please check again.

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

カテゴリ

Help Center および File ExchangeTiming and presenting 2D and 3D stimuli についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by