Export Plots in Classification Learner App

After you create plots interactively in the Classification Learner app, you can export your app plots to MATLAB® figures. You can then copy, save, or customize the new figures. Choose among the available plots: scatter plot, parallel coordinates plot, confusion matrix, and ROC curve.

  • Before exporting a plot, make sure the plot in the app displays the same data that you want in the new figure.

  • On the Classification Learner tab, in the Export section, click Export Plot to Figure.

    The app creates a figure from the selected plot. The new figure might not have the same interactivity options as the plot in the Classification Learner app. For example, in an exported parallel coordinates plot, you cannot drag the bars to reorder the predictors.

  • Copy, save, or customize the new figure, which is displayed in the figure window.

    • To copy the figure, select Edit > Copy Figure. For more information, see Copy Figure to Clipboard from Edit Menu (MATLAB).

    • To save the figure, select File > Save As. Alternatively, you can follow the workflow described in Customize Figure Before Saving (MATLAB).

    • To customize the figure, click the Edit Plot button on the figure toolbar. Right-click the section of the plot that you want to edit. You can change the listed properties, which might include Color, Font, Line Style, and other properties. Or, you can use the Property Inspector to change the figure properties.

As an example, export a scatter plot in the app to a figure, customize the figure, and save the modified figure.

  1. In the MATLAB Command Window, read the sample file fisheriris.csv into a table.

    fishertable = readtable('fisheriris.csv');
  2. Click the Apps tab.

  3. In the Apps section, click the arrow to open the gallery. Under Machine Learning and Deep Learning, click Classification Learner.

  4. On the Classification Learner tab, in the File section, click .

  5. In the New Session dialog box, select the table fishertable from the Workspace Variable list.

  6. Click Start Session. Classification Learner creates a scatter plot of the data by default.

  7. Change the predictors in the scatter plot to PetalLength and PetalWidth.

  8. On the Classification Learner tab, in the Export section, click Export Plot to Figure.

  9. In the new figure, click the Edit Plot button on the figure toolbar. Right-click the points in the plot corresponding to the versicolor irises. In the context menu, select Color.

  10. In the Color dialog box, select a new color and click OK.

  11. To save the figure, select File > Save As. Specify the saved file location, name, and type.

Related Topics