简体   繁体   中英

Is there way to display in MATLAB App Designer UIAxes a boxplot?

I am looking for a way to display in UIAxes boxplots. I thought about saving the plots in a.png format and then using the imshow function of MATLAB. However I would prefer to avoid this process as the result is not the best.

Box-Plot on UIAxes (programatically)

A box-plot can be plotted on a set of uiaxes by passing the axes object as the first argument of the boxplot() function call. In this example I use data built into MATLAB by calling load carsmall . The parent of the uiaxes ( UIAxes ) is the uifigure ( App ).

在 UIAxes 上绘制的箱线图

%App figure properties%
App = uifigure();
App.Name = "GUI";
X_Position = 200; Y_Position = 200;
Height = 300; Width = 600;
App.Position = [X_Position Y_Position Width Height];

UIAxes = uiaxes(App);

%Using built-in sample data to create boxplot%
load carsmall
boxplot(UIAxes,MPG,Origin);
X_Position = 100; Y_Position = 20;
Height = 250; Width = 400;
UIAxes.Position = [X_Position Y_Position Width Height];
UIAxes.XLabel.String = 'Country of Origin';
UIAxes.YLabel.String = 'Miles per Gallon (MPG)';
UIAxes.Title.String = 'Miles per Gallon by Vehicle Origin';

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM