python中水平方向的物理拉伸图 [英] physically stretch plot in horizontal direction in python
问题描述
我想要一个简单的 x,y 图,用 matplotlib 创建,在 x 方向上物理拉伸.
目的是得到一个结果,如果我更容易检测信号中的特征.
I want a simple x,y plot created with matplotlib stretched physically in x-direction.
The intention is to get a result were it is easier for me to detect features in the signal.
所以我不想改变任何尺度、值或限制.只需更改输出文件中两个网格点之间的距离...
So I don't want to change any scales or values or limits. Just change the distance between two gridpoint in my output file...
我想在四个子图上这样做,之后应该具有相同的大小.
I want to do that on four subplots which should have the same size afterwards.
提前致谢...我已经尝试了几个小时,我想你们中的一个人可能会帮助我...
Thanks in advance... I tried for hours now and I think one of you could probably help me...
David Zwicker 已经在这个特殊情况下解决了我的问题,非常感谢,但总的来说......如果我像这段代码一样绘制 2 个子图:
David Zwicker already solved my problem in this special case, thanks a lot for that, but in general... If I plot 2 subplots like in this code:
fig = plt.figure()
ax1 = fig.add_subplot(1,2,1)
plot(u_av,z)
ax2 = fig.add_subplot(1,2,2)
plot(pgrd_av,z)
clf()
并且只想拉伸其中之一.我能做什么?
and want to stretch only one of them. What can I do?
推荐答案
您可以使用 plt.axes()
.例如:
You can directly add axes to the canvas at an arbitrary position with plt.axes()
. For instance:
ax1 = plt.axes([0, 0, 3, 0.5])
ax2 = plt.axes([0, 0.6, 1, 1])
这篇关于python中水平方向的物理拉伸图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!