【问题标题】:Is there way to display in MATLAB App Designer UIAxes a boxplot?有没有办法在 MATLAB App Designer UIAxes 中显示箱线图?
【发布时间】:2021-04-09 21:41:43
【问题描述】:

我正在寻找一种在 UIAxes 箱线图中显示的方法。我考虑将绘图保存为 .png 格式,然后使用 MATLAB 的 imshow 函数。但是我宁愿避免这个过程,因为结果不是最好的。

【问题讨论】:

    标签: matlab boxplot imshow matlab-app-designer


    【解决方案1】:

    UIAxes 上的箱线图(以编程方式)

    通过将坐标区对象作为boxplot() 函数调用的第一个参数传递,可以在一组uiaxes 上绘制箱线图。在此示例中,我通过调用 load carsmall 使用 MATLAB 内置的数据。 uiaxes (UIAxes) 的父级是 uifigure (App)。

    %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';
    

    【讨论】:

      猜你喜欢
      • 2021-08-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-03-06
      • 1970-01-01
      相关资源
      最近更新 更多