フィルターのクリア

How to get a scatterhistogram in an UIAxes (e.g. Matlab App)?

1 回表示 (過去 30 日間)
Gernot Reichl
Gernot Reichl 2024 年 1 月 25 日
コメント済み: Gernot Reichl 2024 年 1 月 25 日
a = [1 2 3 4];
b = [1 2 3 4];
scatterhist(a,b) %works fine sofar
% I would like to display the scatterhist in an uiaxes as for example with
% a boxplot
myAxes = uiaxes;
boxplot(myAxes,a,1)
Unfortunately scatterhist does not support the axes graphics object.
Are there possibilities to fix that?
thank you very much
kind regards

採用された回答

Adam Danz
Adam Danz 2024 年 1 月 25 日
編集済み: Adam Danz 2024 年 1 月 25 日
Scatterhistogram creates a figure with 3 axes. You can expecify where those 3 axes should be using the optional parent argument: scatterhistogram(parent,___) where parent can be a figure, panel, tab object, tiledchartlayout, or gridlayout.
Within your app figure, add a uipanel or one of the other supported objects. Then specify that object in the first argument of scatterhistogram.
Here's a demo that creates a figure instead of an app.
load patients
tbl = table(LastName,Age,Gender,Height,Weight);
fig = figure('Color',[.8 .8 .8]);
uip = uipanel(fig, 'Units','normalized','position', [.3 .3 .6 .6]);
s = scatterhistogram(uip,tbl,'Height','Weight');
If you prefer to use scatterhist, you can use the same workflow except that the parent argument is specified as name-value pair.
load fisheriris
x = meas(:,1);
y = meas(:,2);
fig = figure('Color',[.8 .8 .8]);
uip = uipanel(fig, 'Units','normalized','position', [.3 .3 .6 .6]);
s = scatterhist(x,y,'Parent',uip);
  1 件のコメント
Gernot Reichl
Gernot Reichl 2024 年 1 月 25 日
Thank you very much Mr. Danz. Works great.
I appreciate your fast and professional support! :)
disp('Thank YOU!')
Thank YOU!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMigrate GUIDE Apps についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by