Issue
I have a matlab 3d barplot and within the grid, I understand that there is a background color. However, that color seems to extend outside the grid aswell forming a gray-ish square. I would like to get rid of that since it doesn't make sense and ht is odd with the text around it. Especially around the right side, the numbers 40, 60 and 80 are on the border. I know that I could transform the image into another angle but I would rather not have this gray-ish field around the figure at all.
The figure:
The code:
plt.figure()
ax = plt.axes(projection='3d')
ax.bar3d(xpos,ypos,zpos,dx,dy,dz, alpha=0.4)
Solution
It looks like you are using Seaborn, which gives the gray background. Remove seaborn.set()
from your code. If it does not help, add seaborn.reset_defaults()
before plotting. Then you can define your own theme with the background and panes (planes) white as
ax.xaxis.set_pane_color((1.0, 1.0, 1.0))
ax.yaxis.set_pane_color((1.0, 1.0, 1.0))
ax.zaxis.set_pane_color((1.0, 1.0, 1.0))
You could change the transparency of the panes if you wish:
ax.xaxis.set_pane_color((0.0, 1.0, 0.0, 0.05))
ax.yaxis.set_pane_color((0.0, 1.0, 0.0, 0.05))
ax.zaxis.set_pane_color((0.0, 1.0, 0.0, 0.05))
If that does not work for you, try set_facecolor()
to force it, but then you might need to change axis color:
ax.set_facecolor('white')
ax.xaxis.set_pane_color((1.0, 1.0, 1.0))
ax.yaxis.set_pane_color((1.0, 1.0, 1.0))
ax.zaxis.set_pane_color((1.0, 1.0, 1.0))
ax.xaxis.line.set_color((0.0, 0.0, 0.0))
ax.yaxis.line.set_color((0.0, 0.0, 0.0))
ax.zaxis.line.set_color((0.0, 0.0, 0.0))
Answered By - Raymond
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.