Thank you for the explanation Nathan. I have a better feeling about this now. Also thanks to Ji Souqing for his help too, everything is working now due to your suggestions.
On 10/22/12, Nathan Goldbaum wrote:
I think the confusion may be that the SlicePlot object is a yt class and is not the same thing as a matplotlib plot.
I have attempted to add the line: p.set_zlim(zmin,zmax) into the script above and below the p.set_window command but it returns the error "set_zlim() takes exactly 4 arguments (3 given)". I have tried adding in other arguments to nticks, ticks and minmaxticks but to no avail. Thanks in advance to any advice.
You need to tell set_zlim which field you'd like to set the colorbar limits for:
The reason we've set things up this way is to allow a single plot window to display multiple fields. To do so, you would create the SlicePlot like this:
p = SlicePlot(pf,2,['tele','dens','velx'],origin='left-domain')
I have tried adding in other arguments to nticks, ticks and minmaxticks but to no avail.
I'm not totally sure what you mean here, but maybe this cookbook recipe in the docs will be helpful:
One can directly access the underlying matplotlib figure object by doing something like (using the syntax in your script):
fig = p.plots['tele'].figure
From there it's possible to arbitrarily customize the plot.
This is of course a lot of overhead to customize your plot using SlicePlot. It may be easier in the long run to manually set up your own plots using FixedResolutionBuffer:
Lastly, for your script there is no need to import matplotlib and numpy, yt does that internally. If you're using matplotlib and numpy elsewhere in the script, you'll still need to import it yourself.
On Oct 22, 2012, at 11:30 AM, Ryan Sacks wrote:
I am currently using YT to plot the results from 2D cylindrical FLASH simulations. I am trying to figure out how to set the pseudocolor bar in the Slice plots I am making so that they are consistent through multiple graphs and not automatically set by the data that is loaded in. Any advice that someone could offer as to what commands I should use would be greatly appreciated. The script I am using is below:
from yt.mods import * import matplotlib.pyplot as plt import numpy as np
str_list = ["../life_hdf5_chk_0001", "../life_hdf5_chk_0002", "../life_hdf5_chk_0003", "../life_hdf5_chk_0004", "../life_hdf5_chk_0005", ]
for s in str_list: pf = load(s) p = SlicePlot(pf, 2,'tele',origin='left-domain') p.set_window((0.0, 250.0, 0.0, 250.0)) p.save()
I have attempted to add the line: p.set_zlim(zmin,zmax)
Cheers, Ryan Sacks
-- Ryan F. Sacks University of Wisconsin-Madison Nuclear Engineering and Engineering Physics email@example.com firstname.lastname@example.org...