Fraukje
Fraukje

Reputation: 683

Subplots with only ylabel

I am plotting some MEG time-series stacked horizontally on top of each other. Now I want no axis to be showing but I do want to print each channel number on the left side. So far I've tried this:

figure;
for i=1:10
    subplot(10,1,i)
    plot(1:5000,PDdata{1,1}.data(:,i)) % data to be plotted
    axis off
    ylabel(sprintf('%d',i))
end

Giving me

enter image description here

Unfortunately the ylabel is suppressed by the axis off, how can I suppress all axis options but the ylabel?

Upvotes: 2

Views: 1264

Answers (2)

claudiop
claudiop

Reputation: 140

Use the text function.

for n=1:10
   subplot(10,1,n);
   plot(1:10,1:10);   
   axis off;
   text(0,0,num2str(n));
end

With x and y you can adjust the position of the text.

Upvotes: 2

mbauman
mbauman

Reputation: 31342

You can turn the ylabel back on by setting its visibility to on.

After turning off the axis, simply add:

set(get(gca,'YLabel'),'Visible','on')

Upvotes: 3

Related Questions