I got pretty good results with the code below.  Note that I am reading the
FLIP_COLORS from a gui checkbox.

       FLIP_COLORS = self.dark_background_flag.get()
        if FLIP_COLORS:
            matplotlib.rcParams['figure.facecolor'] = '0.0'
            matplotlib.rcParams['axes.edgecolor'] = 'grey'
            matplotlib.rcParams['text.color'] = 'white'
            matplotlib.rcParams['ytick.color'] = '#00ff00'
            matplotlib.rcParams['xtick.color'] = '#0ED5D5'
            matplotlib.rcParams['axes.labelcolor'] = '#0ED5D5'
            matplotlib.rcParams['axes.facecolor'] = 'black'
            matplotlib.rcParams['grid.color'] = '0.3'
            matplotlib.rcParams['grid.linestyle'] = '-'
            matplotlib.rcParams['lines.markeredgewidth'] = 0.0
        else:
            matplotlib.rcdefaults()

        ## I seems like setting matplotlib.rcParams['figure.facecolor']
isn't
        ## enough.  I think this is a bug and set_facecolor() is a
work-around.
        fig.set_facecolor(matplotlib.rcParams['figure.facecolor'])

This will flip and also flip back.  I found a few colors didn't follow
the crowd.  For example, axes.ylabel.color doesn't seem to have
an entry in rcParams.  For this, I have to modify the plot generation
statments something like:

   ax.set_ylabel('Voltage (volts)',
color=matplotlib.rcParams['ytick.color'])

That sets the ylabel text to be the same as the tick marks.  I also have to
do things like that to change line colors and such when
going flipping colors.

DavidS
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to