change background

The following helpers do the trick for me:

def set_foregroundcolor(ax, color):
     '''For the specified axes, sets the color of the frame, major ticks,
         tick labels, axis labels, title and legend
     for tl in ax.get_xticklines() + ax.get_yticklines():
     for spine in ax.spines:
     for tick in ax.xaxis.get_major_ticks():
     for tick in ax.yaxis.get_major_ticks():
     lh = ax.get_legend()
     if lh != None:
         labels = lh.get_texts()
         for lab in labels:

def set_backgroundcolor(ax, color):
     '''Sets the background color of the current axes (and legend).
         Use 'None' (with quotes) for transparent. To get transparent
         background on saved figures, use:
         pp.savefig("fig1.svg", transparent=True)
     lh = ax.get_legend()
     if lh != None:


Christopher Brown, Ph.D.
Associate Research Professor
Department of Speech and Hearing Science
Arizona State University