Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'bins' keyword argument ignored in histogram #4651

Closed
TheoMathurin opened this issue Oct 19, 2020 · 8 comments · Fixed by #5750
Closed

'bins' keyword argument ignored in histogram #4651

TheoMathurin opened this issue Oct 19, 2020 · 8 comments · Fixed by #5750
Labels
type: bug Something isn't correct or isn't working
Milestone

Comments

@TheoMathurin
Copy link
Contributor

Hi,

It seems like setting the number of bins through the bins keyword argument in histograms does nothing.

Let's take an example in the Holoviews demos:

import holoviews as hv
from holoviews import opts
hv.extension('bokeh')
from bokeh.sampledata.autompg import autompg

autompg_ds = hv.Dataset(autompg)
hist = autompg_ds.hist(dimension='mpg', groupby='cyl', bin_range=(9, 46), bins=40, adjoin=False)
hist.opts(opts.Histogram(alpha=0.9, width=600))

Setting bins to 40 or 10 or 100 does not change the output. Note that I encounter the same behavior when using histogram() from holoviews.operation.element.

Or maybe I'm getting something wrong?

Config:

  • Holoviews 1.13.4
  • Jupyter notebook with bokeh backend
  • Python 3.8
  • Browser: Chromium / Firefox
  • OS: CentOS 7
@TizianoGC
Copy link

I can confirm this behaviour.

OS: Ubuntu 20.04.1 LTS
Packages:
Python 3.7.9
Holoviews 1.14.1
Bokeh 2.2.3
Firefox 84.0

@hiroshi80
Copy link

me too.

  • OS: CentOS 7.9-2009
  • Python 3.6.13
  • Holoviews 1.14.4
  • bokeh 2.3.0
  • matplotlib 3.3.4
  • Chrome: 92.0

@jbednar jbednar added the type: bug Something isn't correct or isn't working label Aug 20, 2021
@jbednar jbednar added this to the 1.14.5 milestone Aug 20, 2021
@philippjfr philippjfr modified the milestones: 1.14.6, 1.14.7 Oct 18, 2021
@philippjfr philippjfr modified the milestones: 1.14.7, 1.14.8 Jan 21, 2022
@jbednar jbednar modified the milestones: 1.14.9, 1.14.10 Jun 21, 2022
@jlstevens jlstevens modified the milestones: 1.15.0, 1.15.1 Aug 8, 2022
@hoxbro
Copy link
Member

hoxbro commented Sep 8, 2022

The command to use is num_bins. Sorry for the late answer.

image

image

image

@hoxbro
Copy link
Member

hoxbro commented Sep 8, 2022

A little surprised that setting bins to an integer does not raise an error as it should only support np.ndarray, list, tuple, str as seen here:

bins = param.ClassSelector(default=None, class_=(np.ndarray, list, tuple, str), doc="""

So it seems that histogram bypasses the __init__ and therefore never validates the parameters. Do you have an explanation for this, @jlstevens?

@TheoMathurin
Copy link
Contributor Author

Ok so this is more of a usage/docs issue. Please don't hesitate to close the issue or update it accordingly.

@maximlt maximlt modified the milestones: 1.15.1, 1.15.2 Oct 14, 2022
@maximlt
Copy link
Member

maximlt commented Oct 19, 2022

A little surprised that setting bins to an integer does not raise an error as it should only support

I was surprised too, but it's actually a long-standing issue with ParamOverrides holoviz/param#85

@jbednar
Copy link
Member

jbednar commented Oct 21, 2022

Ah yes. Someone should do something about holoviz/param#85!

Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 23, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: bug Something isn't correct or isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants