I have set
import matplotlib as mpl
AXES_COLOR = '#333333'
mpl.rc('axes', edgecolor=AXES_COLOR, labelcolor=AXES_COLOR, grid=True)
mpl.rc('xtick', color=AXES_COLOR)
mpl.rc('ytick', color=AXES_COLOR)
mpl.rc('grid', color=AXES_COLOR)
The color of the axes labels and the ticks are properly set both in 2D and in 3D. However, the edgecolor
doesn't apply to 3D axes and they remain black. Likewise, the grid isn't affected.
I think figured out how to access the individual axes of a 3D plot:
import matplotlib.pyplot as plt
import mpl_toolkits.mplot3d # Needed for 3d projection.
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
ax.w_zaxis # <- the z axis
The documentation mentions a property that we can use until the developers have finished refactoring their 3D code:
import pprint
pprint.pprint(ax.w_xaxis._AXINFO)
{'x': {'color': (0.95, 0.95, 0.95, 0.5),
'i': 0,
'juggled': (1, 0, 2),
'tickdir': 1},
'y': {'color': (0.9, 0.9, 0.9, 0.5),
'i': 1,
'juggled': (0, 1, 2),
'tickdir': 0},
'z': {'color': (0.925, 0.925, 0.925, 0.5),
'i': 2,
'juggled': (0, 2, 1),
'tickdir': 0}}
However, the color parameter changes the color of the background of the axes planes (between the wired of the grid), not the color of the edges of these planes.
Am I digging too deep ?