Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
axis off -> xaxis off

Subject: axis off -> xaxis off

From: Suguleasa

Date: 2 Jul, 2008 16:18:02

Message: 1 of 4


I want to turn off only the x axis, but not the y axis. Is
there a way to do it?

Thanks!
Suguleasa

Subject: axis off -> xaxis off

From: Yuri Geshelin

Date: 2 Jul, 2008 19:28:02

Message: 2 of 4

"Suguleasa " <suguleasa@gmail.com> wrote in message
<g4g9nq$d8j$1@fred.mathworks.com>...
>
> I want to turn off only the x axis, but not the y axis. Is
> there a way to do it?
>
> Thanks!
> Suguleasa

Hi,

Here is a trick:

set(gca, 'xcolor ',XCOL, 'xtick ',[])

where XCOL is a color that makes the X-axis invisible (most
commonly, white). Of course, the axis is still there:
something to keep in mind when you set up other axes or
make use of these gca properties:

Layer, LineWidth etc.

In addition, if you print your image in a file, use this
command:

set(gcf, 'color ',XCOL)

This is an awkward solution. There may be others, but I do
not know of them.

Yuri

Subject: axis off -> xaxis off

From: Suguleasa

Date: 2 Jul, 2008 20:15:11

Message: 3 of 4

Yes, that's what I ended up doing. The idea was to free the
pixels taken by the width of the axes.
I also tried to set LineWidth to zero, but it returned an
error message that the width has to be greater than zero. I
believe Matlab should be more flexible with regard to this.

Thank you for the reply!
Suguleasa


"Yuri Geshelin" <geshelin@hotmail.com> wrote in message
<g4gks2$9fi$1@fred.mathworks.com>...
> "Suguleasa " <suguleasa@gmail.com> wrote in message
> <g4g9nq$d8j$1@fred.mathworks.com>...
> >
> > I want to turn off only the x axis, but not the y axis. Is
> > there a way to do it?
> >
> > Thanks!
> > Suguleasa
>
> Hi,
>
> Here is a trick:
>
> set(gca, 'xcolor ',XCOL, 'xtick ',[])
>
> where XCOL is a color that makes the X-axis invisible (most
> commonly, white). Of course, the axis is still there:
> something to keep in mind when you set up other axes or
> make use of these gca properties:
>
> Layer, LineWidth etc.
>
> In addition, if you print your image in a file, use this
> command:
>
> set(gcf, 'color ',XCOL)
>
> This is an awkward solution. There may be others, but I do
> not know of them.
>
> Yuri
>
>
>

Subject: axis off -> xaxis off

From: Simon

Date: 18 May, 2009 04:29:02

Message: 4 of 4

I met the same problem and the solution works. Thanks!

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us