From: Nicholas Kinar on
Hello---

I am generating a number of plots which will be stacked on top of each
other for easy comparison. In other words, each plot will be exported as
an image file (JPEG or TIFF) and placed on a PowerPoint slide.

All of these plots have the same tick labels on the x-axis. I am
wondering if there is a way to turn off the tick labels on one of the
plots using Matlab code.

Hypothetically, this would involve the use of a function such as

xticklabel('off')

For example, here's a example script using this hypothetical function:

x = 1:10;
y = sin(x);
plot(x,y);
xticklabel('off');

Calling this function would turn off the tick labels on the x-axis.
Does such a function exist? If not, then is there a series of Matlab
commands that I can enter to turn the tick labels off?

Nicholas
From: TideMan on
On Jun 4, 8:11 am, Nicholas Kinar <n.ki...(a)usask.ca> wrote:
> Hello---
>
> I am generating a number of plots which will be stacked on top of each
> other for easy comparison. In other words, each plot will be exported as
> an image file (JPEG or TIFF) and placed on a PowerPoint slide.
>
> All of these plots have the same tick labels on the x-axis.  I am
> wondering if there is a way to turn off the tick labels on one of the
> plots using Matlab code.
>
> Hypothetically, this would involve the use of a function such as
>
> xticklabel('off')
>
> For example, here's a example script using this hypothetical function:
>
> x = 1:10;
> y = sin(x);
> plot(x,y);
> xticklabel('off');
>
> Calling this function would turn off the tick labels on the x-axis.
> Does such a function exist?  If not, then is there a series of Matlab
> commands that I can enter to turn the tick labels off?
>
> Nicholas

You need to learn about handle graphics.
It is a very powerful facility for controlling plots.
Look for "handles to graphics objects" in the Matlab help.

set(gca,...
'XTickLabel','')
gca is the current axes.
It's saying: in the current axes, set the XTickLabels to empty
strings.


From: Jan Simon on
Dear Nicholas!

> I am generating a number of plots which will be stacked on top of each
> other for easy comparison. In other words, each plot will be exported as
> an image file (JPEG or TIFF) and placed on a PowerPoint slide.
>
> All of these plots have the same tick labels on the x-axis. I am
> wondering if there is a way to turn off the tick labels on one of the
> plots using Matlab code.
>
> Hypothetically, this would involve the use of a function such as
> xticklabel('off')

set(gca, 'XTick', []);

Jan
From: someone on
Nicholas Kinar <n.kinar(a)usask.ca> wrote in message <4C080C8B.3000303(a)usask.ca>...
> Hello---
>
> I am generating a number of plots which will be stacked on top of each
> other for easy comparison. In other words, each plot will be exported as
> an image file (JPEG or TIFF) and placed on a PowerPoint slide.
>
> All of these plots have the same tick labels on the x-axis. I am
> wondering if there is a way to turn off the tick labels on one of the
> plots using Matlab code.
>
> Hypothetically, this would involve the use of a function such as
>
> xticklabel('off')
>
> For example, here's a example script using this hypothetical function:
>
> x = 1:10;
> y = sin(x);
> plot(x,y);
> xticklabel('off');
>
> Calling this function would turn off the tick labels on the x-axis.
> Does such a function exist? If not, then is there a series of Matlab
> commands that I can enter to turn the tick labels off?
>
> Nicholas

% Look at the help for Axes Properrties.
doc axes
% Then click on the Axes Properties link in the See Also section.

% You can try something like:
set(gca,'XTickLabel',[])
% where gca is the handle to your current axes.
From: Nicholas Kinar on

> You need to learn about handle graphics.
> It is a very powerful facility for controlling plots.
> Look for "handles to graphics objects" in the Matlab help.
>
> set(gca,...
> 'XTickLabel','')
> gca is the current axes.
> It's saying: in the current axes, set the XTickLabels to empty
> strings.
>

That's great; thank you very much for enlightening me, TideMan. I tried
this, and it worked well by removing only the XTickLabels. The ticks
still remained.

Thank you also for suggesting the interesting documentation!

Nicholas Kinar