the annotation to select it and drag it to the desired location. Press the Delete key to delete the
selected annotation.
For example, suppose that you want to add formatting and annotations to the figure in
patients.mlx.
1
Add a title — In the Annotations section, select
Title. A blue rectangle appears
prompting you to enter text. Type the text Weight vs. Height and press Enter.
2
Add X and Y Labels — In the Annotations section, select
X-Label. A blue rectangle
appears prompting you to enter text. Type the text Height and press Enter. Select
YLabel. A blue rectangle appears prompting you to enter text. Type the text Weight and press
Enter.
3
Add a legend — In the Annotations section, select
Legend. A legend appears at the top
right corner of the axes. Click the data1 description in the legend and replace the text with
Female. Click the data2 description in the legend and replace the text with Male. Press Enter.
4
Add grid lines — In the Annotations section, select
Grid. Grid lines appear in the axes.
5
Add an arrow annotation — In the Annotations section, select
Text Arrow. Drawing
the arrow from tail to head, position the arrow on the scatter plot pointing to the lightest patient.
Enter the text Lightest Patient and press Enter
6
Update the code — In the selected figure, click the Update Code button. The live script now
contains the code needed to reproduce the figure changes.
grid on
legend({'Female','Male'})
title('Weight vs Height')
xlabel('Height')
ylabel('Weight')
annotation('textarrow',[0.455 0.3979],[0.3393 0.13],'String','Lightest Patient');
Modify Figures in Live Scripts
19-15
Précédent

- 633/1450

Suivant