Advertisement
Guest User

Untitled

a guest
Mar 19th, 2019
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.26 KB | None | 0 0
  1. import matplotlib.pyplot as plt
  2. plt.hist(x, cumulative=True, histtype='step')
  3.  
  4. import plotly.graph_objs as go
  5. from plotly.offline import iplot
  6. h = go.Histogram(x=x,
  7. cumulative=dict(enabled=True),
  8. marker=dict(color="rgba(0,0,0,0)",
  9. line=dict(color="red", width=1)))
  10. iplot([h])
  11.  
  12. #imports
  13. import plotly.plotly as py
  14. import plotly.graph_objs as go
  15. from plotly.offline import download_plotlyjs, init_notebook_mode, plot, iplot
  16.  
  17. import numpy as np
  18. import pandas as pd
  19.  
  20. # qtconsole for debugginh
  21. #%qtconsole -- style vim
  22.  
  23. # Notebook settings
  24. init_notebook_mode(connected=True)
  25.  
  26. # Some sample data
  27. x = np.random.normal(50, 5, 500)
  28. binned = np.histogram(x, bins=25, density=True)
  29. plot_y = np.cumsum(binned[0])
  30.  
  31. # Line
  32. trace1 = go.Scatter(
  33. x=binned[1],
  34. y=plot_y,
  35. mode='lines',
  36. name="X",
  37. hoverinfo='all',
  38. line=dict(color = 'rgb(1255, 0, 0)', shape='hvh'
  39. )
  40. )
  41.  
  42. data = [trace1]
  43.  
  44. # Layout
  45. layout = dict(title = 'Binned data from normal distribution',
  46. legend=dict(
  47. y=0.5,
  48. traceorder='reversed',
  49. font=dict(
  50. size=16
  51. )
  52. )
  53. )
  54.  
  55. # Make figure
  56. fig = dict(data=data, layout=layout)
  57.  
  58. # Plot
  59. iplot(fig, filename='line-shapes')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement