[yt-users] Problem with multi plot
Reju Sam John
rejusamjohn at gmail.com
Tue Aug 6 10:09:58 PDT 2013
Dear all,
I am trying to create a muti plot of density's at different red-shift with
the following code.
from yt.mods import *
import matplotlib.colorbar as cb
fig, axes, colorbars = get_multi_plot( 3, 3, colorbar='vertical', bw = 3)
file1="/app/run/csarkar/surajit/simulation_shock/simulation5/RD00"
file2="/RedshiftOutput00"
L = [11,15,18,20,22,25,30,35,40]
#for i in range (0, 8):
for kk in L:
fn_i=str(kk)
fn=file1+fn_i+file2+fn_i
print fn
pf = load(fn)
pc = PlotCollection(pf, center=[0.5, 0.5, 0.5])
for i in range (0,3):
for j in range (0, 3):
p = pc.add_slice("Density", 2, axes = axes[i][j],figure = fig,
use_colorbar=False)
p.set_log_field(True)
p.set_zlim(1e-31,5e-26)
p.set_cmap("jet")
p.modify["contour"]("Density", ncont=10, plot_args =
{'colors':'w'},clim=(2e-28,2e-26))
p.modify["contour"]("Temperature", ncont=10, plot_args =
{'colors':'k'},clim=(3e7,1e8))
#pc.set_width(3.0, 'mpc')
#break
# i = i+1
for p, cax in zip(pc.plots, colorbars):
cbar = cb.Colorbar(cax, p.image, orientation='vertical')
p.colorbar = cbar
p._autoset_label()
fig.savefig("multi_plot_3_3" % pf)
But I am getting a wrong result. It is printing same figure in all panels.
I think my logic(algorithm) is wrong. We have to reverse first two for
loop. But that also making problem. Please help me.
And also if I include the following line in the code. (in my code I
commented it out)
pc.set_width(3.0, 'mpc')
it is showing following error.
*Traceback (most recent call last):*
* File "multi_plot_loop.py", line 24, in <module>*
* pc.set_width(3.0, 'mpc') *
* File
"/data1/pdf/csurajit/yt-x86_64/src/yt-hg/yt/visualization/plot_collection.py",
line 292, in set_width*
* plot.set_width(width, unit)*
* File
"/data1/pdf/csurajit/yt-x86_64/src/yt-hg/yt/visualization/plot_types.py",
line 458, in set_width*
* self._refresh_display_width()*
* File
"/data1/pdf/csurajit/yt-x86_64/src/yt-hg/yt/visualization/plot_types.py",
line 476, in _refresh_display_width*
* self._redraw_image()*
* File
"/data1/pdf/csurajit/yt-x86_64/src/yt-hg/yt/visualization/plot_types.py",
line 423, in _redraw_image*
* self._run_callbacks()*
* File
"/data1/pdf/csurajit/yt-x86_64/src/yt-hg/yt/visualization/plot_types.py",
line 263, in _run_callbacks*
* cb(self)*
* File
"/data1/pdf/csurajit/yt-x86_64/src/yt-hg/yt/visualization/plot_modifications.py",
line 312, in __call__*
* self.ncont = np.linspace(self.clim[0], self.clim[1], self.ncont)*
* File
"/data1/pdf/csurajit/yt-x86_64/lib/python2.7/site-packages/numpy/core/function_base.py",
line 74, in linspace*
* num = int(num)*
*TypeError: only length-1 arrays can be converted to Python scalars*
Please suggest me the most efficient way to achieve my goal (create a muti
plot of density's at different red-shift).
--
Reju Sam John
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20130806/0dadcdbf/attachment.htm>
More information about the yt-users
mailing list