Add and Modify Multiple Subplots
You can combine multiple plots by creating subplots in a figure. To add multiple subplots to your
figure, use the Subplot button to divide the figure into a grid of subplots. First, select the desired
figure. Then, go to the Figure tab and choose a subplot layout using the Subplot button. You only
can add additional subplots to a figure if the figure contains one subplot. If a figure contains multiple
subplots, the Subplot button is disabled.
For example, suppose that you want to compare the blood pressure of smoking and non-smoking
patients. Create a live script called patients_smoking.mlx and add code that loads the health
information for 100 different patients.
load patients
Run the code by going to the Live Editor tab and clicking
Run.
Add a scatter plot that shows the systolic blood pressure of patients that smoke versus the systolic
blood pressure of patients that do not smoke. Run the code.
figure
scatter(Age(Smoker==1),Systolic(Smoker==1));
hold on
19 Live Scripts and Functions
19-16
Précédent

- 634/1450

Suivant