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

New to MATLAB?

Thread Subject:
Auto position of axes labels and title

Subject: Auto position of axes labels and title

From: R Wat

Date: 23 Aug, 2011 13:04:10

Message: 1 of 1

So, I know the topic of positioning axes labels has been address quite a few times, but my question is a little different than the old posts. By default, MATLAB has a function that automatically positions the x, y and z labels, along with the axes title. For the x label, it is positioned 50% of the way down the x axes; there is similar positioning for the y and z labels and the title. I could manually change the position of the x (y, or z) labels by something like

set(get(gca,'XLabel'),'Position',[newx newy newz])

but there is a drawback to this method. Say I change the view of the plot (such as zooming in or rotating the camera angle), the label may go out of view (which is not the case in the default functionality of the axes labels - they would stay at their 50% spacing along the axis). I could set up a whole bunch of listeners to update the location of the labels, but that can get really messy and, if your not careful, very buggy.

This leads me to my question: does anyone know where it MATLAB that it is coded in that the labels are %50 of the way down the axes. If so, is there a way to tweak some parameters so that is is, say, %60 of the way down the axes instead without killing the rest of the default functionality of the axes label positioning?

Hope this makes sense. Thanks for any input you may have!

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