I am trying to plot a pointcloud using matplotlib and I would like to extend the time axis, while keeping the x and y axes the same, essentially turning my plot into more of an oblong than a cube. At the moment I have the following code:
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()
The resulting plot looks like this:
Just changing the range of the time axis winds up squishing the data whilst keeping the axis the same size.
I am aware that there are some "solutions" to this problem; notably here and here, but these answers either don't work for me, or require me to actually edit code in the matplotlib library, which then causes other scripts of mine to stop working... Also, these answers are quite old now (2012 most recently), so I was wondering if there are any fresh solutions to this problem.