question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

'bins' keyword argument ignored in histogram

See original GitHub issue

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

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
maximltcommented, 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 https://github.com/holoviz/param/issues/85

1reaction
Hoxbrocommented, Sep 8, 2022

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

image

image

image

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot get histogram to show separated bins with vertical lines
Using your example: import numpy as np import matplotlib.pyplot as plt x = np.random.rand((100)) bins = np.linspace(0, 2, ...
Read more >
matplotlib.pyplot.hist — Matplotlib 3.1.2 documentation
Deprecated ; use the density keyword argument instead. Returns: n : array or list of arrays. The values of the histogram bins. See ......
Read more >
Matplotlib.pyplot.hist() in Python - GeeksforGeeks
It uses the density keyword argument instead. Returns: This returns the following: n :This returns the values of the histogram bins. bins ......
Read more >
pandas.Series.plot.hist — pandas 1.5.2 documentation
Number of histogram bins to be used. **kwargs. Additional keyword arguments are documented in DataFrame.plot() . Returns. class: matplotlib.AxesSubplot.
Read more >
hist function - RDocumentation
Arguments · x. a vector of values for which the histogram is desired. · breaks. one of: · freq · probability · include....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found