I was trying to plot a figure with a combination of a 3d subplot and 3 2d ones. Why do they overlap each other?
Here are my codes:
fig = plt.figure(figsize=(10,10))
ax = fig.add_subplot(3, 2, 1, projection='3d')
ax = plt.axes(projection='3d')
ax.scatter3D(extents[0], extents[1], extents[2], color='yellow')
ax = fig.add_subplot(3, 2, 2)
ax = sns.distplot(extents[0], color='red')
ax.set_title("Extent_0 Distribution")
ax = fig.add_subplot(3, 2, 4)
ax = sns.distplot(extents[1], color='blue')
ax.set_title("Extent_1 Distribution")
ax = fig.add_subplot(3, 2, 6)
ax = sns.distplot(extents[2], color='green')
ax.set_title("Extent_2 Distribution")
plt.show()
ax
is created withax = fig.add_subplot(3, 2, 1, projection='3d')
, but then you reassign the variable withax = plt.axes(projection='3d')
; this does not plot toax
.ax
parameter in the plot methodsns.histplot(df['freq: 1x'], ax=ax)
sns.distplot
is deprecated fordisplot
orhistplot
.Using matplotlib gridspec
nrows
.gs1 = fig.add_gridspec(nrows=4, ncols=3)