|
From: | Raag Saluja |
Subject: | Re: categorical bar graph |
Date: | Tue, 29 Oct 2019 17:47:02 +0530 |
On Tue, Oct 29, 2019, 7:57 AM Raag Saluja <address@hidden> wrote:What do I do if I want to make subplots, with the same xticklabels, please? I tried this:y1= [5 2 3 1];
y2= [3 2 2 1];
subplot(2,2,1),bar(y1),subplot(2,2,2),bar(y2)
set(gca,"xticklabel",{'small', 'medium', 'large', 'extra large'});
PFA a screenshot of the output I got.
I'm not at my computer at the moment, but this should do it:y1= [5 2 3 1];y2= [3 2 2 1];subplot(2,2,1)bar(y1)set(gca,"xticklabel",{'small', 'medium', 'large', 'extra large'});subplot(2,2,2)bar(y2)set(gca,"xticklabel",{'small', 'medium', 'large', 'extra large'});gca returns the current axes. It refers to the first plot's axes until you create the second plot. Then it refers to the second plot's axes.
[Prev in Thread] | Current Thread | [Next in Thread] |