views:

466

answers:

2

Is there a way to change the color of an axis (not the ticks) in matplotlib? I have been looking through the docs for Axes, Axis, and Artist, but no luck; the matplotlib gallery also has no hint. Any idea?

+3  A: 

For the record, this is how I managed to make it work:

fig = pylab.figure()
ax  = fig.add_subplot(1, 1, 1)
for child in ax.get_children():
    if isinstance(child, matplotlib.spines.Spine):
        child.set_color('#dddddd')
knipknap
+1, much better than using the global rc.
Mark
thanks for this, hopefully matplotlib will add a simpler way of achieving this.
jhanifen
+1  A: 

You can do it by adjusting the default rc settings.

import matplotlib
from matplotlib import pyplot as plt

matplotlib.rc('axes',edgecolor='r')
plt.plot([0, 1], [0, 1])
plt.savefig('test.png')
Mark