## move x-axis to top of matlab figure

December 5th, 2009 by Lawrence David

to move the x-axis on a figure from the bottom of your plot to the top, adjust the ‘xaxislocation’ variable of your current axis handle:

matlab>> set(gca,’XAxisLocation’,'top’)

on 22 Mar 2011 at 5:30 amMarcusThank you man, it was just what i searched.

Thanks again

on 18 May 2011 at 9:34 amVladimirthanks bro,

sometimes the easiest things can not be found but you have done it really simple, thanks!!!

on 04 Jun 2011 at 4:46 amMATLAB Menagerie « Labrigger[...] have been handy. Blogger Stinkpot writes very brief notes on MATLAB sporadically. Items include Moving the X-axis to the top of a plot and Inserting a MATLAB matrix in to [...]

on 28 Jul 2011 at 1:49 pmAustinThank you very much!

Every once in a while I search for something that I need to do in Matlab and your site keeps popping up. Thanks for posting all your useful tips!

on 25 Sep 2012 at 11:41 amDaveThanks!

Also, if you want to bring the axis to the top layer (ie: showing on top of datapoints in your figure), adjust the layer location:

matlab>> set(gca,’layer’,'top’)

on 13 Feb 2013 at 2:15 amYadhunathThere is no ‘XAxisLocation’ property in the ‘root’ class. what should i do?