Giter Site home page Giter Site logo

ignore nan in hist() about holoviews HOT 5 CLOSED

holoviz avatar holoviz commented on August 22, 2024
ignore nan in hist()

from holoviews.

Comments (5)

jlstevens avatar jlstevens commented on August 22, 2024

I think this is a reasonable feature request that should be fairly easy to implement.

from holoviews.

philippjfr avatar philippjfr commented on August 22, 2024

Fixed in a981515, let me know if it works for you so I can close this issue.

from holoviews.

basnijholt avatar basnijholt commented on August 22, 2024

Thanks for doing this!

This works:

z1.hist()

But this doesn't

In [6]:

z1.hist(bin_range=(1e-5, z1.data.max()))
Traceback (most recent call last):
  File "/home/bnijholt/python/env_stable/lib/python2.7/site-packages/holoviews/ipython/display_hooks.py", line 203, in wrapped
    **kwargs)
  File "/home/bnijholt/python/env_stable/lib/python2.7/site-packages/holoviews/ipython/display_hooks.py", line 279, in layout_display
    return display_figure(fig)
  File "/home/bnijholt/python/env_stable/lib/python2.7/site-packages/holoviews/ipython/display_hooks.py", line 168, in display_figure
    figdata = renderer.figure_data(fig, figure_format)
  File "/home/bnijholt/python/env_stable/lib/python2.7/site-packages/holoviews/plotting/__init__.py", line 252, in figure_data
    fig.canvas.print_figure(bytes_io, **kw)
  File "/home/bnijholt/python/env_stable/lib/python2.7/site-packages/matplotlib/backend_bases.py", line 2168, in print_figure
    bbox = a.get_window_extent(renderer)
  File "/home/bnijholt/python/env_stable/lib/python2.7/site-packages/matplotlib/patches.py", line 491, in get_window_extent
    return self.get_path().get_extents(self.get_transform())
  File "/home/bnijholt/python/env_stable/lib/python2.7/site-packages/matplotlib/path.py", line 518, in get_extents
    transform = transform.frozen()
  File "/home/bnijholt/python/env_stable/lib/python2.7/site-packages/matplotlib/transforms.py", line 2067, in frozen
    return blended_transform_factory(self._x.frozen(), self._y.frozen())
  File "/home/bnijholt/python/env_stable/lib/python2.7/site-packages/matplotlib/transforms.py", line 2201, in blended_transform_factory
    return BlendedAffine2D(x_transform, y_transform)
  File "/home/bnijholt/python/env_stable/lib/python2.7/site-packages/matplotlib/transforms.py", line 2148, in __init__
    assert y_transform.is_separable
AssertionError
Out[6]:
:AdjointLayout   [AdjointLayout]
   :Histogram   [Band gap]   (Frequency)

from holoviews.

philippjfr avatar philippjfr commented on August 22, 2024

Presumably that's because

z1.data.max()

Returns np.NaN, so I think that behavior is desired, you provided an invalid range so it will complain. It should probably complain long before it gets to plotting but if you want to do that then just use:

z1.hist(bin_range=(1e-5, np.nanmax(z1.data)))

from holoviews.

basnijholt avatar basnijholt commented on August 22, 2024

Yes, works like a charm 👍

from holoviews.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.