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
2010-01-01 19:04:10
+1, much better than using the global rc.
Mark
2010-01-01 19:15:21
thanks for this, hopefully matplotlib will add a simpler way of achieving this.
jhanifen
2010-10-13 17:07:13
+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
2010-01-01 19:14:36