[yt-users] Plot Background

Nathan Goldbaum nathan12343 at gmail.com
Wed May 28 13:51:19 PDT 2014


Hi Andrew,

On Wed, May 28, 2014 at 1:12 PM, Andrew James Emerick <
emerick at astro.columbia.edu> wrote:

> Is there a way to set the background color for projection plots? I'd like
> to set it to be black instead of white, which I assume is the default.
>

That's right, following matplotlib's defaults.

There are two options to create a plot with a black background color.  The
first is to pass the 'facecolor' keyword argument down to matplotlib when
calling the save function.  Unfortunately since the foreground is black by
default, you'll also have to adjust the colors of all of the axes, tick
marks, axes text, colorbars, etc to be white. Here is an example notebook
that does this:
http://nbviewer.ipython.org/gist/ngoldbaum/7367380cbe6683159da5

Another option would be to adjust the matplotlib defaults in your
matplotlibrc (http://matplotlib.org/1.3.1/users/customizing.html) so that
figures have a black background by default.

I have to say that I kind of like the way the black background looks and
could definitely see it being useful in some situations.  I don't think it
would be very hard to add a "set_black_theme" function that does more or
less what my notebook does.  That would probably be a nice afternoon hack
for someone that wanted to familiarize themselves with yt's plotting code.

Hope that's helpful,

Nathan


>
>
>
> Thanks,
> Andrew E.
> --
> Graduate Student
> Columbia University
> Department of Astronomy
>
> _______________________________________________
> yt-users mailing list
> yt-users at lists.spacepope.org
> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20140528/e312021c/attachment.html>


More information about the yt-users mailing list