views:

77

answers:

1

Hi. I like to switch x axis with y axis after plotting a graph with matplotlib? Any easy way for it? Thanks in advance.

A: 

You can simply switch x and y parameters in the plot function:

I[3]: x = np.linspace(0,2*np.pi, 100)

I[4]: y = np.sin(x)

I[5]: plt.plot(x,y)

I[6]: plt.figure(); plt.plot(y,x)
Gökhan Sever
Thanks, but it is not the answer I am seeking. I am asking how to switch x and y axes after I have plotted all data.
Daehyok Shin