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 <> wrote:
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.


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.


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.


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')

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

    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,
        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 "", line 4, in <module>
  File "/nics/b/home/collins/local_2013_03_12/src/yt-hg/yt/visualization/", line 1184, in add_phase_object
    figure=figure, axes=axes))
  File "/nics/b/home/collins/local_2013_03_12/src/yt-hg/yt/visualization/", line 815, in __init__
  File "/nics/b/home/collins/local_2013_03_12/src/yt-hg/yt/visualization/", line 834, in __init_colorbar
    format="%0.2e" )
  File "/nics/b/home/collins/local_2013_03_12/lib/python2.7/site-packages/matplotlib/", 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/", 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/", line 854, in __init__
    ColorbarBase.__init__(self, ax, **kw)
  File "/nics/b/home/collins/local_2013_03_12/lib/python2.7/site-packages/matplotlib/", line 298, in __init__
  File "/nics/b/home/collins/local_2013_03_12/lib/python2.7/site-packages/matplotlib/", 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/", line 409, in _config_axes
  File "/nics/b/home/collins/local_2013_03_12/lib/python2.7/site-packages/matplotlib/", 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/", line 560, in _ticker
    ticks = self._locate(b)
  File "/nics/b/home/collins/local_2013_03_12/lib/python2.7/site-packages/matplotlib/", 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 mailing list

yt-users mailing list

yt-users mailing list