Python Numpy add hspace between 3D plot and 2D plot with shared axes -
attached image showing current plot. setting fig.subplots_adjust(hspace=0)
2d plots share common x-axis. add space between 3d , 2d plots not quite sure how accomplish hspace set 0.
fig.subplots_adjust(hspace=0) ax in [px_t, py_t, pz_t]: plt.setp(ax.get_xticklabels(), visible=false)
in case, it's best use 2 separate gridspec
instances. way can have 2 separate hspace
parameters. alternatively, can manually place top axes.
as example of first option:
import matplotlib.pyplot plt mpl_toolkits import mplot3d fig = plt.figure(figsize=(8, 10)) gs1 = plt.gridspec(2, 1, hspace=0.2) gs2 = plt.gridspec(8, 1, hspace=0) ax1 = fig.add_subplot(gs1[0], projection='3d') ax1.plot(range(10), range(10), range(10)) ax = fig.add_subplot(gs2[4]) lower_axes = [ax] in range(4, 8): if > 4: ax = fig.add_subplot(gs2[i], sharex=lower_axes[0]) ax.plot(range(10)) ax.locator_params(axis='y', nbins=5, prune='both') lower_axes.append(ax) ax in lower_axes: ax.label_outer() plt.show()
Comments
Post a Comment