Python matplotlib -> 3D bar plot -> adjusting tick label position, transparent bars

你。 提交于 2019-12-03 03:37:40

To make the bars semi-transparent, you just have to use the alpha parameter. alpha=0 means 100% transparent, while alpha=1 (the default) means 0% transparent.

Try this, it will work out to make the bars semi-transparent:

ax.bar3d(xpos,ypos,zpos, dx, dy, dz, color='b', alpha=0.5)

Regarding the ticks location, you can do it using something like this (the first list on plt.xticks or plt.yticks contains the "values" where do you want to locate the ticks, and the second list contains what you actually want to call the ticks):

#ax.w_xaxis.set_ticklabels(column_names)
#ax.w_yaxis.set_ticklabels(row_names)

ticksx = np.arange(0.5, 5, 1)
plt.xticks(ticksx, column_names)

ticksy = np.arange(0.6, 7, 1)
plt.yticks(ticksy, row_names)

In the end, I get this figure:

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!