I am using a sequence of barplot on 3D projection to generate 3D bar plot as per code which is given below. But, axis tick labels are displayed much far from axis line. How can I reduce distance between axis and axis tick labels? Further tick labels are not seems properly aligned with axis.
code snap is given below:
fig = plt.figure(figsize=(3,2),dpi=300)
plt.rc('font', size=4)
ax = fig.add_subplot(111, projection='3d')
ax.set_box_aspect(aspect=None, zoom=0.8) #--to resolve axis label cut-off problem
z=np.arange(len(list(df_3d)))
print("z",z)
print(list(df_3d))
for n, i in enumerate(df_3d):
# print ('n',n)
xs = np.arange(len(df_3d[i]))
ys = [i for i in df_3d[i]]
zs = z[n]
cs = colors[n]
# print (' xs:', xs,'ys:', ys, 'zs',zs, ' cs: ',cs)
ax.bar(xs, ys, zs, zdir='y', color=cs, alpha=0.8)
yaxislabels=[]
for i in list(df_3d):
yaxislabels.append("")
yaxislabels.append(i)
ax.set_yticklabels(yaxislabels) #(list(df_3d))
ax.set_xlabel(axislabels[0],labelpad=0.5)
ax.set_ylabel(axislabels[1],labelpad=0.5)
ax.set_zlabel(axislabels[2],rotation=90,labelpad=0.5)
plt.show()
How can I reduce distance between axis and axis labels ?
I do not find any alternate solution. Please, help.