[yt-users] Axis labels and text annotations

Jeremy Ritter jritter at astro.as.utexas.edu
Sat May 3 20:53:45 PDT 2014


Hello,

I'm relatively new to YT. Creating great looking plots seems to be really easy, but setting axis labels and other text labels (timestamps) has proven to be quite challenging. I'm creating some phase plots with the latest stable version (2.6 I think), and I would like for variables to have proper names, e.g. "Number Density" instead of "NumberDensity". 

I first tried changing the labels using the axes object set_xlabel/set_ylabel methods, but that removes the units and doesn't accept latex style commands for making my own units. It also appears to change the font style.

Then I tried creating derived fields with the proper names including spaces, but it seems that the labels get squished, having all spaces removed when it prints the label. Filename output still has the spaces in the variable name.

What is the easiest way to set publication quality axis labels with units in v2.6?

My other problem seems to be that I'm unable to use any of the annotation callbacks with a phase plot. Is this true? I just want to add a timestamp, for which I've already created the string, e.g. "5.35 Myr".

Thanks!
-Jeremy


More information about the yt-users mailing list