Advertisement
Guest User

Untitled

a guest
Jun 25th, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 KB | None | 0 0
  1. from plotly import tools
  2. import plotly.plotly as py
  3. import numpy as np
  4. import pandas as pd
  5. import matplotlib.pyplot as plt
  6. import plotly.offline as pyo
  7. import plotly.graph_objs as go
  8.  
  9. df = pd.read_csv("C:\DATA_REPORT_subset.csv")
  10. meas_set = df['Tool_MeasurementSet'].unique()
  11.  
  12. ## params are the column labels in the df dataframe
  13. params = ['Data','UCL','LCL','CL']
  14.  
  15. for i in meas_set:
  16. fig = tools.make_subplots(rows=2, cols=1,subplot_titles=('X-BAR Subplot','SIGMA Subplot'))
  17. for j in range(0,len(params)):
  18. y_xbar = df[(df['Tool_MeasurementSet']== i) & (df['Chart Type']== 'X-BAR')][params[j]]
  19. x_xbar = df[(df['Tool_MeasurementSet']== i) & (df['Chart Type']== 'X-BAR')]['Date']
  20. y_sigma = df[(df['Tool_MeasurementSet']== i) & (df['Chart Type']== 'SIGMA')][params[j]]
  21. x_sigma = df[(df['Tool_MeasurementSet']== i) & (df['Chart Type']== 'SIGMA')]['Date']
  22. trace1 = go.Scatter(x=x_xbar,y=y_xbar,mode='lines',name=params[j])
  23. trace2 = go.Scatter(x=x_sigma,y=y_sigma,mode='lines',name=params[j])
  24.  
  25. fig.append_trace(trace1,1,1)
  26. fig.append_trace(trace2,2,1)
  27.  
  28. fig['layout'].update(title= i)
  29. pyo.plot(fig)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement