简体   繁体   English

如何在matplotlib中设置轴不相等?

[英]how to set axis in matplotlib not equal?

I have the following figure in matplotlib . 我在matplotlib有下图。 What i want to do is to have the scale of z-axis proportional to xy-axis. 我想要做的是使z轴的比例与xy轴成比例。

matplotlib图

and achieve something like this: 并实现以下目标:

原始图

adding the following works: 添加以下作品:

ax.set_zlim(-1, 1)

correct figure 正确的身材

however i wonder if there is an alternative way! 但是我想知道是否还有另一种方法!

There is more than one way you can do that; 您可以通过多种方法来实现此目的。

Approach 1: 方法1:

Setting the axis limit: 设置轴限制:

plt.zlim(tuple)

where 哪里

tuple = (z0,zf)

another way: 其他方式:

plt.zticks(array_1, array_2)

where 哪里

array_1 := range
array_2 := labels

Hope it helps! 希望能帮助到你!

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

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