<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, May 29, 2014 at 7:42 AM, Andrew James Emerick <span dir="ltr"><<a href="mailto:emerick@astro.columbia.edu" target="_blank">emerick@astro.columbia.edu</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">Nathan & Christine,<div><br></div><div>

Thanks for the fixes. The 'dumb' solution is the one I was planning on doing if there wasn't a more attractive option, but I wanted to see if there was a built-in way to do this without changing the field values. </div>


<div><br></div><div>Nathan:</div><div>I do like your solution, and I do like the way the white on black looks in the plot. Its probably not universally useful, but I can imagine using it in some cases. Is there any way to do the matplotlib level commands though such that its just the background within the plot itself that changes (keeping the plot borders white). Basically doing what Christine suggested without editing the fields. </div>

</div></blockquote><div><br></div><div>Ah, well I guess my solution was a bit overkill, eh?</div><div><br></div><div>What you want to do is actually quite simple:</div><div><br></div><div><a href="http://nbviewer.ipython.org/gist/ngoldbaum/494689db94a2b4e29781">http://nbviewer.ipython.org/gist/ngoldbaum/494689db94a2b4e29781</a><br>

</div><div><br></div><div>Note that you might not want to use black as the facecolor - I would probably only use black if the colormap I was using had black as its lower bound.</div><div><br></div><div>Another option would be to use a masked array and a custom colormap, e.g. following this:</div>

<div><br></div><div><a href="http://stackoverflow.com/questions/2578752/how-can-i-plot-nan-values-as-a-special-color-with-imshow-in-matplotlib">http://stackoverflow.com/questions/2578752/how-can-i-plot-nan-values-as-a-special-color-with-imshow-in-matplotlib</a><br>

</div><div><br></div><div>To get this to work you'd need to add the colormap to yt's index of known colormaps.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">

<div dir="ltr">
<div><br></div><div><br></div><div><br></div><div>Andrew E. </div></div><div class=""><div class="h5"><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, May 28, 2014 at 5:00 PM, Christine Simpson <span dir="ltr"><<a href="mailto:csimpson@astro.columbia.edu" target="_blank">csimpson@astro.columbia.edu</a>></span> wrote:<br>


<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div style="word-wrap:break-word">A third rather dumb solution that I use is to add a tinny-tiny number to the field I’m projecting.  I assume you are getting the white where the field is zero?  If you are using a color bar with black as the color for the lowest value (like 'gray’), this will give you black where the field you are projecting is zero (or rather tinny-tiny).<span><font color="#888888"><div>


<br></div><div>Christine</div></font></span><div><div><div><br><div><div>On May 28, 2014, at 2:51 PM, Nathan Goldbaum <<a href="mailto:nathan12343@gmail.com" target="_blank">nathan12343@gmail.com</a>> wrote:</div>
<br><blockquote type="cite"><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">


<div dir="ltr">Hi Andrew,<div class="gmail_extra"><br><div class="gmail_quote">On Wed, May 28, 2014 at 1:12 PM, Andrew James Emerick<span> </span><span dir="ltr"><<a href="mailto:emerick@astro.columbia.edu" target="_blank">emerick@astro.columbia.edu</a>></span><span> </span>wrote:<br>


<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">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.</div>


</blockquote><div><br></div><div>That's right, following matplotlib's defaults.</div><div><br></div><div>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: <a href="http://nbviewer.ipython.org/gist/ngoldbaum/7367380cbe6683159da5" target="_blank">http://nbviewer.ipython.org/gist/ngoldbaum/7367380cbe6683159da5</a></div>


<div><br></div><div>Another option would be to adjust the matplotlib defaults in your matplotlibrc (<a href="http://matplotlib.org/1.3.1/users/customizing.html" target="_blank">http://matplotlib.org/1.3.1/users/customizing.html</a>) so that figures have a black background by default.</div>


<div><br></div><div>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.</div>


<div><br></div><div>Hope that's helpful,</div><div><br></div><div>Nathan</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">


<div dir="ltr"><div><br></div><div><br></div><div><br></div><div>Thanks,</div><div>Andrew E.<span><font color="#888888"><br>--<span> </span><br><div dir="ltr"><div style="font-family:arial;font-size:small">Graduate Student </div>


<div style="font-family:arial;font-size:small">Columbia University</div><div style="font-family:arial;font-size:small">Department of Astronomy</div></div></font></span></div></div><br>_______________________________________________<br>


yt-users mailing list<br><a href="mailto:yt-users@lists.spacepope.org" target="_blank">yt-users@lists.spacepope.org</a><br><a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" target="_blank">http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org</a><br>


<br></blockquote></div><br></div></div>_______________________________________________<br>yt-users mailing list<br><a href="mailto:yt-users@lists.spacepope.org" target="_blank">yt-users@lists.spacepope.org</a><br><a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" target="_blank">http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org</a></div>


</blockquote></div><br></div></div></div></div><br>_______________________________________________<br>
yt-users mailing list<br>
<a href="mailto:yt-users@lists.spacepope.org" target="_blank">yt-users@lists.spacepope.org</a><br>
<a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" target="_blank">http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div dir="ltr"><div style="font-family:arial;font-size:small">Graduate Student </div><div style="font-family:arial;font-size:small">Columbia University</div>


<div style="font-family:arial;font-size:small">Department of Astronomy</div></div>
</div>
</div></div><br>_______________________________________________<br>
yt-users mailing list<br>
<a href="mailto:yt-users@lists.spacepope.org">yt-users@lists.spacepope.org</a><br>
<a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" target="_blank">http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org</a><br>
<br></blockquote></div><br></div></div>