python中的水平绘图

python中的水平绘图,python,matplotlib,orientation,Python,Matplotlib,Orientation,我在寻找一个顺时针旋转90度的图。类似的例子是“hist(x,orientation='horizontal')”。有没有办法达到类似的方向 #Make horizontal plots. import random import matplotlib.pyplot as plt x = random.sample(range(1000), 100) x plt.plot(x) #orientation='horizontal' plt.show() plt.plot(x)根据y轴自动绘制x值

我在寻找一个顺时针旋转90度的图。类似的例子是“hist(x,orientation='horizontal')”。有没有办法达到类似的方向

#Make horizontal plots.
import random
import matplotlib.pyplot as plt
x = random.sample(range(1000), 100)
x
plt.plot(x) #orientation='horizontal'
plt.show()
plt.plot(x)
根据y轴自动绘制x值。为了获得旋转的绘图,必须根据x轴绘制x值。因此,您需要为y轴生成向量,y轴的长度与示例相同

import random
import matplotlib.pyplot as plt
import numpy as np

x=random.sample(1000)
y=np.arange(1000)
plt.plot(x,y)
使用
plt.plot(x)
,matplotlib将x值作为其y值,并自动生成x轴的矢量