Feed on

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’)

Bookmark and Share

if that was helpful ...

check out the other tips and tricks i've compiled on these pages. you might learn something else interesting!

6 Responses to “move x-axis to top of matlab figure”

  1. on 22 Mar 2011 at 5:30 am Marcus

    Thank you man, it was just what i searched.
    Thanks again

  2. on 18 May 2011 at 9:34 am Vladimir

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

  3. on 04 Jun 2011 at 4:46 am MATLAB 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 [...]

  4. on 28 Jul 2011 at 1:49 pm Austin

    Thank 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!

  5. on 25 Sep 2012 at 11:41 am Dave

    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’)

  6. on 13 Feb 2013 at 2:15 am Yadhunath

    There is no ‘XAxisLocation’ property in the ‘root’ class. what should i do?

Did I get this wrong? Let me know!

Trackback URI | Comments RSS