1

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.

1 Answers1

1

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).

Boxplot Plotted on 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';
MichaelTr7
  • 4,737
  • 2
  • 6
  • 21