Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from plotly import tools
- import plotly.plotly as py
- import numpy as np
- import pandas as pd
- import matplotlib.pyplot as plt
- import plotly.offline as pyo
- import plotly.graph_objs as go
- df = pd.read_csv("C:\DATA_REPORT_subset.csv")
- meas_set = df['Tool_MeasurementSet'].unique()
- ## params are the column labels in the df dataframe
- params = ['Data','UCL','LCL','CL']
- for i in meas_set:
- fig = tools.make_subplots(rows=2, cols=1,subplot_titles=('X-BAR Subplot','SIGMA Subplot'))
- for j in range(0,len(params)):
- y_xbar = df[(df['Tool_MeasurementSet']== i) & (df['Chart Type']== 'X-BAR')][params[j]]
- x_xbar = df[(df['Tool_MeasurementSet']== i) & (df['Chart Type']== 'X-BAR')]['Date']
- y_sigma = df[(df['Tool_MeasurementSet']== i) & (df['Chart Type']== 'SIGMA')][params[j]]
- x_sigma = df[(df['Tool_MeasurementSet']== i) & (df['Chart Type']== 'SIGMA')]['Date']
- trace1 = go.Scatter(x=x_xbar,y=y_xbar,mode='lines',name=params[j])
- trace2 = go.Scatter(x=x_sigma,y=y_sigma,mode='lines',name=params[j])
- fig.append_trace(trace1,1,1)
- fig.append_trace(trace2,2,1)
- fig['layout'].update(title= i)
- pyo.plot(fig)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement