As Geoffrey mentioned, you can manually construct the histogram using
BinnedProfile1D or BinnedProfile2D and then plot it up yourself using e.g.
matplotlib's pyplot.
It's on my radar to finish up Matt's improved profile plotting interface
but for right now the only way to do this is via PlotCollection.
On Fri, Apr 26, 2013 at 4:38 PM, Geoffrey So
I think another way of doing similar things is using BinnedProfile2D, or if the dataset is small matplotlib has a histogram2d which I sometimes use.
From G.S.
On Fri, Apr 26, 2013 at 4:15 PM, David Collins
wrote: I was under the impression that these things used the values of take_log that from FieldInfo, which is False for the velocity components.
Using Density instead of x-velocity still throws the same error.
d.
On Fri, Apr 26, 2013 at 5:11 PM, Geoffrey So
wrote: Could it also be trying to take log of negative values in the velocity? If so changing x-velcity to another positive field would not end in error.
From G.S.
On Fri, Apr 26, 2013 at 4:06 PM, David Collins
wrote: Hi, all--
I'm running into problems making phase objects. It looks like the error is in the color bar, and is similar to other errors I get when trying to use PlotCollections. The hash I'm on is 34b95297062b. I'm trying:
pf = load(fname) pc = PlotCollection(pf,'c') phase=pc.add_phase_object(pf.h.all_data(),['CellMass', 'x-velocity','CellVolume'],weight=None)
min/max are as follows: CellMass: [4.1e-12,1.5e-03] (30631133,) x-velocity: [-7.2e+01,5.5e+01] CellVolume: [1.45e-11,6.0e-08]
Is there a more up-to-date manner to do this that doesn't use PlotCollection? Or is there something obvious that I'm missing?
It seems to be choking in plot_types.py/__init_colorbar
def __init_colorbar(self): temparray = np.ones((self.x_bins.size, self.y_bins.size)) self.norm = matplotlib.colors.Normalize() self.image = self._axes.pcolormesh(self.x_bins, self.y_bins, temparray, shading='flat', norm=self.norm, cmap=self.cmap, rasterized=True) self.colorbar = self._figure.colorbar(self.image, extend='neither', shrink=0.95, format="%0.2e" )
It looks like what's happening is figure.colorbar chokes on the fact that temparray is "ones", so the spacing between elements is zero. This is outside of my yt knowledge, though.
Traceback (most recent call last): File "<stdin>", line 1, in <module> File "p14_phase_test.py", line 4, in <module>
phase=pc.add_phase_object(pf.h.all_data(),['CellMass','x-velocity','CellVolume']) File "/nics/b/home/collins/local_2013_03_12/src/yt-hg/yt/visualization/plot_collection.py", line 1184, in add_phase_object figure=figure, axes=axes)) File "/nics/b/home/collins/local_2013_03_12/src/yt-hg/yt/visualization/plot_types.py", line 815, in __init__ self.__init_colorbar() File "/nics/b/home/collins/local_2013_03_12/src/yt-hg/yt/visualization/plot_types.py", line 834, in __init_colorbar format="%0.2e" ) File "/nics/b/home/collins/local_2013_03_12/lib/python2.7/site-packages/matplotlib/figure.py", line 1387, in colorbar cb = cbar.colorbar_factory(cax, mappable, **kw) File "/nics/b/home/collins/local_2013_03_12/lib/python2.7/site-packages/matplotlib/colorbar.py", line 1173, in colorbar_factory cb = Colorbar(cax, mappable, **kwargs) File "/nics/b/home/collins/local_2013_03_12/lib/python2.7/site-packages/matplotlib/colorbar.py", line 854, in __init__ ColorbarBase.__init__(self, ax, **kw) File "/nics/b/home/collins/local_2013_03_12/lib/python2.7/site-packages/matplotlib/colorbar.py", line 298, in __init__ self.draw_all() File "/nics/b/home/collins/local_2013_03_12/lib/python2.7/site-packages/matplotlib/colorbar.py", line 323, in draw_all self._config_axes(X, Y) File "/nics/b/home/collins/local_2013_03_12/lib/python2.7/site-packages/matplotlib/colorbar.py", line 409, in _config_axes self.update_ticks() File "/nics/b/home/collins/local_2013_03_12/lib/python2.7/site-packages/matplotlib/colorbar.py", line 345, in update_ticks ticks, ticklabels, offset_string = self._ticker() File "/nics/b/home/collins/local_2013_03_12/lib/python2.7/site-packages/matplotlib/colorbar.py", line 560, in _ticker ticks = self._locate(b) File "/nics/b/home/collins/local_2013_03_12/lib/python2.7/site-packages/matplotlib/colorbar.py", line 808, in _locate z = np.take(y, i0) + (xn-np.take(b,i0))*dy/db FloatingPointError: invalid value encountered in divide
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org