While editing a .fig matlab file, I want to swap the x and y axes without redrawing the plot by code (without changing the order of vector data). Does a solution exist to my problem? Is there some option in the figure properties menu? Thanks in advance.
In addition to Luis 's answer you can set the current axes View
property to [90 -90]
directly from the property inspector.
Programmatically this is equivalent to this:
set(gca,'View',[90 -90])
Note:
Thanks to Luis for the correction. Using [-90 90]
does swap the axis but then you need to reverse the direction of the y-axis. Therefore it's better to use [90 -90]
.
Simple example:
Before swap:
And then after changing the view: