Skip to content

Histogram in 3.4.0 #1257

Closed
Closed
@sursu

Description

@sursu

Hi, I think there is an issue with FigureWidget in 3.4.0. The behavior I will describe below did not exist in 3.3.0.

I use Jupyter Lab.

import numpy as np

import plotly.graph_objs as go
from plotly.offline import init_notebook_mode, iplot
init_notebook_mode(connected=True)
# Simulations
n = 100
A = np.arange(1,n+1, dtype=float).reshape(n,1)**(-2)
X = 2*np.random.randint(2, size=(n,1000000))-1

Now, this works:
iplot([go.Histogram(x=np.sum(A*X,axis=0))])

newplot

This does not work (even though it did before):

# Histogram for S_n
fig = go.FigureWidget()
fig.add_histogram(x=np.sum(A*X,axis=0),
                  opacity=0.75,
                  histnorm='probability density')
fig['layout'].update(title='Distribution of $S_{'+str(n)+'}$', 
                  showlegend=False, height=700)
fig

newplot 1

Also, note that part of the title is not displayed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugsomething broken

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions