简体   繁体   English

有没有办法在 MATLAB App Designer UIAxes 中显示箱线图?

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

I am looking for a way to display in UIAxes boxplots.我正在寻找一种在 UIAxes 箱线图中显示的方法。 I thought about saving the plots in a.png format and then using the imshow function of MATLAB.我考虑将绘图保存为 a.png 格式,然后使用 MATLAB 的 imshow function。 However I would prefer to avoid this process as the result is not the best.但是我宁愿避免这个过程,因为结果不是最好的。

Box-Plot on UIAxes (programatically) UIAxes 上的箱线图(以编程方式)

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.通过将轴 object 作为 boxplot boxplot() function 调用的第一个参数,可以在一组uiaxes上绘制箱线图。 In this example I use data built into MATLAB by calling load carsmall .在这个例子中,我通过调用load carsmall来使用 MATLAB 内置的数据。 The parent of the uiaxes ( UIAxes ) is the uifigure ( App ). uiaxes ( UIAxes ) 的父级是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';

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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