In [1]:
%matplotlib inline
from yt.mods import *
In [2]:
# Adapted from the matplotlib mailing list
# http://matplotlib.1069221.n5.nabble.com/change-background-td9352.html

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():
         tl.set_color(color)
     for spine in ax.spines:
         ax.spines[spine].set_edgecolor(color)
     for tick in ax.xaxis.get_major_ticks():
         tick.label1.set_color(color)
     for tick in ax.yaxis.get_major_ticks():
         tick.label1.set_color(color)
     ax.axes.xaxis.label.set_color(color)
     ax.axes.yaxis.label.set_color(color)
     ax.axes.xaxis.get_offset_text().set_color(color)
     ax.axes.yaxis.get_offset_text().set_color(color)
     ax.axes.title.set_color(color)
     lh = ax.get_legend()
     if lh != None:
         lh.get_title().set_color(color)
         lh.legendPatch.set_edgecolor('none')
         labels = lh.get_texts()
         for lab in labels:
             lab.set_color(color)
     for tl in ax.get_xticklabels():
         tl.set_color(color)
     for tl in ax.get_yticklabels():
         tl.set_color(color)
In [3]:
ds = load('IsolatedGalaxy/galaxy0030/galaxy0030')
prj = ProjectionPlot(ds, 0, 'density')

plot= prj.plots['density']

set_foregroundcolor(plot.axes, 'white')
set_foregroundcolor(plot.cax, 'white')

plot.cb.outline.set_color('white')

fn = prj.save(mpl_kwargs={"facecolor":"black"})[0]

# displaying the image inline in the notebook. 
# It should be on your hard drive if you've run this locally.
from IPython.display import Image

Image(fn)
Out[3]: