Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/url/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 在matplotlib中更改三维打印的纵横比_Python_Matplotlib_Plot_Mplot3d - Fatal编程技术网

Python 在matplotlib中更改三维打印的纵横比

Python 在matplotlib中更改三维打印的纵横比,python,matplotlib,plot,mplot3d,Python,Matplotlib,Plot,Mplot3d,我正在尝试使用matplotlib绘制点云,我想扩展时间轴,同时保持x轴和y轴相同,基本上将我的绘图变成长方形而不是立方体。目前,我有以下代码: def plot_events(event_slice, cap_events, frame_idx): number_to_display = 5 number_cap_events_to_display = 1 eventsize = 2 plt.rcParams.update({'font.size': 22}) fig = plt.figu

我正在尝试使用matplotlib绘制点云,我想扩展时间轴,同时保持x轴和y轴相同,基本上将我的绘图变成长方形而不是立方体。目前,我有以下代码:

def plot_events(event_slice, cap_events, frame_idx):
number_to_display = 5
number_cap_events_to_display = 1
eventsize = 2

plt.rcParams.update({'font.size': 22})

fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')

ax.view_init(elev=33., azim=140)

ax.set_xlabel('time [s]')
ax.set_ylabel('x')
ax.set_zlabel('y')

ax.set_xticklabels([""])
ax.set_yticklabels([""])
ax.set_zticklabels([""])

ax.set_ylim([0, 240])
ax.set_zlim([0, 180])

X = event_slice[0::number_to_display, t_col]
Y = event_slice[0::number_to_display, x_col]
Z = event_slice[0::number_to_display, y_col]

ax.scatter(X, Y, Z, s=eventsize, c=(event_slice[0::number_to_display, 3]),
           edgecolors='none', cmap=custom_cm)
ax.scatter(cap_events[0::number_cap_events_to_display, t_col], cap_events[0::number_cap_events_to_display, x_col],
           cap_events[0::number_cap_events_to_display, y_col], s=eventsize, c='k',
           edgecolors='none')

fig.tight_layout()
plt.show()

plt.close()
生成的绘图如下所示: 只要改变时间轴的范围,就会在保持时间轴大小不变的同时挤压数据


我知道这个问题有一些“解决办法”;值得注意的是和,但这些答案要么不适用于我,要么要求我实际编辑matplotlib库中的代码,这会导致我的其他脚本停止工作。。。此外,这些答案现在已经很老了(最近是2012年),所以我想知道是否有新的解决方案来解决这个问题。

除了重复的解决方案之外,没有其他解决方案。