Suppose I have a plotting function that takes an axes argument (or returns one). Is there some low-level method for transposing the whole plot so that the x-axis becomes the
Not more than a wrap for tcaswell's answer.
def swap(*line_list):
"""
Example
-------
line = plot(linspace(0, 2, 10), rand(10))
swap(line)
"""
for lines in line_list:
try:
iter(lines)
except:
lines = [lines]
for line in lines:
xdata, ydata = line.get_xdata(), line.get_ydata()
line.set_xdata(ydata)
line.set_ydata(xdata)
line.axes.autoscale_view()
An example
line = plot(linspace(0, 2, 10), rand(10))
swap(line)