简体   繁体   English

Matplotlib 2D图垂直x轴

[英]Matplotlib 2D plot vertical x-axis

I was wondering if there is a quick way to have, in a 2D plot, the x-axis oriented vertically, from top to bottom. 我想知道是否有一种快速的方法可以在2D图中使x轴从上到下垂直定向。 I am looking for the Matlab equivalent of 我正在寻找与

 set(gca,'view',[90,90])

if any. 如果有的话。

The only solution I found is How can I rotate a matplotlib plot through 90 degrees? 我找到的唯一解决方案是如何将matplotlib图旋转90度? but I cannot make in work because I have several plots on the figure 但是我无法进行工作,因为我在图上有几个图

One way you could accomplish this is just to swap the X, Y values you pass to the function. 您可以完成此操作的一种方法就是交换传递给函数的X,Y值。 For example, if you have lists of X values and Y values (the points are (X[i], Y[i]), you could just do: 例如,如果您有X值和Y值的列表(点为(X [i],Y [i])),则可以执行以下操作:

scatter(Y,X)

instead of 代替

scatter(X,Y)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM