Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Swapping x & y Axis in Matlab

Potentially easy matlab question here, but I've searched and can't sort out how to do this.

I've got a variables, which plot like this: Example

I simple want the x axis to be the y axis and vice versa. How do I swap them?

Thank you in advance for your help!!

like image 787
Laura Avatar asked Apr 21 '15 22:04

Laura


People also ask

Why XOR is used for swapping?

In computer programming, the exclusive or swap (sometimes shortened to XOR swap) is an algorithm that uses the exclusive or bitwise operation to swap the values of two variables without using the temporary variable which is normally required.

What is the example of swapping?

Swaps Summary For example, a company paying a variable rate of interest may swap its interest payments with another company that will then pay the first company a fixed rate. Swaps can also be used to exchange other kinds of value or risk like the potential for a credit default in a bond.

What is the method of swapping?

The swap() method of java. util. Collections class is used to swap the elements at the specified positions in the specified list. If the specified positions are equal, invoking this method leaves the list unchanged.


1 Answers

The standard way would be to swap the arguments passed to plot:

plot(ydata, xdata) %// instead of plot(xdata, ydata)

Failing that, you can change the view to rotate the axes:

view([90 -90]) %// instead of normal view, which is view([0 90])
like image 103
Luis Mendo Avatar answered Oct 15 '22 20:10

Luis Mendo