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.

az.plot_dist(kind=hist) and bins arg raises exception

See original GitHub issue

Following code raises an exception

import arviz as az
newcomb = pd.read_csv("https://raw.githubusercontent.com/avehtari/ROS-Examples/master/Newcomb/data/newcomb.txt")
az.plot_dist(newcomb.values, hist_kwargs=dict(bins=30))

image

Matplotlib version does not

import matplotlib.pyplot as plt
newcomb = pd.read_csv("https://raw.githubusercontent.com/avehtari/ROS-Examples/master/Newcomb/data/newcomb.txt")
plt.hist(newcomb.values,bins=30)

image

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
ahartikainencommented, Jul 19, 2020

Yes, there is an error. We probably should grab the bins returned from the plot call.

https://github.com/arviz-devs/arviz/blob/d046cea6d2847c63f9207826d8e478e429ae2374/arviz/plots/backends/matplotlib/distplot.py#L126

to

        n, bins, _ = ax.hist(np.asarray(values).flatten(), bins=bins, **hist_kwargs)
0reactions
OriolAbrilcommented, Jul 21, 2020

The idea would be something like this test where instead of using continuous_model["y"] as data a list was passed as data. Similar test with matplotlib here too in case it helps.

We want to make sure the preprocessing works and the figure is generated, what is not checked is the generated figure so things like color, axis limits… are generally not chekced. In this particular case we actually want to check the preprocessing basically so everything should work fine.

Read more comments on GitHub >

github_iconTop Results From Across the Web

az.plot_dist(kind=hist) and bins arg raises exception #1306
Following code raises an exception import arviz as az newcomb ... az.plot_dist(kind=hist) and bins arg raises exception #1306.
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