MATLAB Answers

Vertically stacked subplots with x-axis labels only at the bottom

Asked by Douglas Anderson on 25 Jan 2013

Hi,

I searched and couldn't find the answer to what I am guessing is a simple problem. I need several waveforms in separate subplots, all with the same X limits. The tick marks aren't a problem, but the numbers effectively limit the number of subplots, squeezing the data out!

Is there a simple way to have only one set of x coordinate labels and a label 'time' below that?

'axis off' won't work because it removes the ticks and the background, and I still want them.

Thanks.

Doug Anderson

  0 Comments

Products

3 Answers

Answer by Sean de Wolski
on 25 Jan 2013

How about just turning off the 'XTick'

for ii = 1:9
  subplot(9,1,ii);
  plot(rand(1,10));
  if ii < 9
      set(gca,'XTick',[]);
  end   
end

  0 Comments


Answer by Nike
on 25 Jan 2013
Edited by Nike
on 25 Jan 2013

Hi Douglas,

Why dont you try turning the XTicks off for all the wavforms except the bottom one or ty using this

 use this in the for loop you use to subplot to delete the numbers in the X axis
%
set(gca,'xtick',[],'ytick',[])
 Use this after th for loop to set the numbers at the bottom of the screen
set(gca,'xtickMode', 'auto')

Hope this helps

Nike

  0 Comments


Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply today