geds133
geds133

Reputation: 1485

Plotly not loading fig when `fig.show()` called

I am trying to make and show a distplot plotly figure in the PyCharm IDE but the browser it tries loading in seems to buffer forever. My data and chart is as such:

import plotly.figure_factory as ff

hist_data = 
[[23740.0, 66440.0, 47890.0, 40632.0, 51778.0, 59966.0, 92433.0, 101595.0, 53863.0, 27279.0, 49620.0, 14981.0], 
[32566.0, 95661.0, 69957.0, 62255.0, 73688.0, 90606.0, 163077.0, 151885.0, 80432.0, 39790.0, 76275.0, 23061.0], 
[41811.0, 122388.0, 87849.0, 80795.0, 98960.0, 123870.0, 245555.0, 204934.0, 105540.0, 49233.0, 98183.0, 29583.0]]


# Group data together
group_labels = ['1997', '2007', '2017']

fig = ff.create_distplot(hist_data, group_labels, bin_size=.2)
fig.show()

I don't think it's a problem with the code it seems to be something to do with calling the figure. The code is for reprodicibility. If anyone knows how to debug this that would be great.

Upvotes: 1

Views: 1434

Answers (1)

r-beginners
r-beginners

Reputation: 35205

The cause of the lack of drawing is that the binning numbers are too small and require a large amount of calculation and freeze. I adjusted the bin_size=10000 appropriately, and it shows up.

fig = ff.create_distplot(hist_data, group_labels, bin_size=10000)

enter image description here

Upvotes: 5

Related Questions