Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import matplotlib.pyplot as plt
- plt.hist(x, cumulative=True, histtype='step')
- import plotly.graph_objs as go
- from plotly.offline import iplot
- h = go.Histogram(x=x,
- cumulative=dict(enabled=True),
- marker=dict(color="rgba(0,0,0,0)",
- line=dict(color="red", width=1)))
- iplot([h])
- #imports
- import plotly.plotly as py
- import plotly.graph_objs as go
- from plotly.offline import download_plotlyjs, init_notebook_mode, plot, iplot
- import numpy as np
- import pandas as pd
- # qtconsole for debugginh
- #%qtconsole -- style vim
- # Notebook settings
- init_notebook_mode(connected=True)
- # Some sample data
- x = np.random.normal(50, 5, 500)
- binned = np.histogram(x, bins=25, density=True)
- plot_y = np.cumsum(binned[0])
- # Line
- trace1 = go.Scatter(
- x=binned[1],
- y=plot_y,
- mode='lines',
- name="X",
- hoverinfo='all',
- line=dict(color = 'rgb(1255, 0, 0)', shape='hvh'
- )
- )
- data = [trace1]
- # Layout
- layout = dict(title = 'Binned data from normal distribution',
- legend=dict(
- y=0.5,
- traceorder='reversed',
- font=dict(
- size=16
- )
- )
- )
- # Make figure
- fig = dict(data=data, layout=layout)
- # Plot
- iplot(fig, filename='line-shapes')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement