[yt-dev] Display name formatting

Nathan Goldbaum nathan12343 at gmail.com
Fri Sep 7 17:06:16 PDT 2012


Hi all,

I've just run into an issue with the way plot window currently handles the derived field display_names.  Everything works great so long as the display name is an ascii string (true for 99% of yt fields) but if I define a new field and I want the display name to include some latex macros, things currently break.

I've hacked up a solution in this changeset: https://bitbucket.org/ngoldbaum/yt-cleancopy/changeset/5087f6769726a9527b508470eb1b904bfe6beacd

This allows me to make plots like this: http://i.imgur.com/a8G9e.png Or this: http://i.imgur.com/TTgAY.png if I define the fields as in this paste: http://paste.yt-project.org/show/2683/

This wasn't a problem using PlotCollection since the colorbar label wasn't rendered in mathtext unless the display_name string was explicitly passed as mathtext.  When I finished up plot window I decided to force the axis labels and colorbar labels to be mathtext so that the unit label and field name are rendered in the same font.  

A simpler solution would be to go back to annotating the labels using the matplotlib fonts.  I'm -1 on that since I think the plots don't look as nice.

Personally, I'm +1 on my changeset but since this is a biggish change that might interfere with user-defined fields, I wanted to open a discussion on the dev list about how to handle the issue before submitting a PR.

Cheers,

Nathan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spacepope.org/pipermail/yt-dev-spacepope.org/attachments/20120907/28cdfc8b/attachment.htm>


More information about the yt-dev mailing list