def process_pie(): df = process_input() df[df.columns[1]] = pd.to_numeric(df[df.columns[1]]) df[df.columns[2]] = pd.to_numeric(df[df.columns[2]]) df[df.columns[3]] = pd.to_numeric(df[df.columns[3]]) col1 = df[df.columns[1]].values col2 = df[df.columns[2]].values col3 = df[df.columns[3]].values Plotly.plot(document.getElementById('plot1'), [{ 'values': [ df[df.columns[1]].sum(), df[df.columns[2]].sum(), df[df.columns[3]].sum() ], 'labels': [ df[df.columns[1]].name, df[df.columns[2]].name, df[df.columns[3]].name ], 'type': 'pie' }], { 'height': 350, 'width': 500 })
async def plot(UR, Sawyer, inst, state_flags_enum): xs = [] ys = [] # Add x and y to lists for obj in await inst.async_get_objects(None): xs.append(obj.x/1000.) ys.append(obj.y/1000.) sawyer_state = await Sawyer.robot_state.AsyncPeekInValue(None) ur_state = await UR.robot_state.AsyncPeekInValue(None) pose_Sawyer=sawyer_state[0].kin_chain_tcp q_Sawyer=sawyer_state[0].joint_position q_UR=ur_state[0].joint_position pose_UR=ur_state[0].kin_chain_tcp # Draw x and y lists pose_Sawyer_C=np.dot(H_S_C,np.array([[pose_Sawyer[0]['position']['x']],[pose_Sawyer[0]['position']['y']],[1]])) pose_UR_C=np.dot(H_UR_C,np.array([[pose_UR[0]['position']['x']],[pose_UR[0]['position']['y']],[1]])) objects={ 'y': ys, 'x': xs ,'mode':'markers','name':'objects','type':'scatter','marker':{'size':10,'color':'#000000'}} UR5_robot={ 'y': pose_UR_C[1], 'x': pose_UR_C[0] ,'mode':'markers','name':'UR5_robot','type':'scatter','marker':{'size':10,'color':'#27e3d3'}} Sawyer_robot={ 'y': pose_Sawyer_C[1], 'x': pose_Sawyer_C[0] ,'mode':'markers','name':'Sawyer_robot','type':'scatter','marker':{'size':10,'color':'#e31010'}} Plotly.react('plot',[objects,UR5_robot, Sawyer_robot])
def process_scatter(): df = process_input() col1 = df[df.columns[0]].values col2 = df[df.columns[1]].values Plotly.plot(document.getElementById('plot2'), [{ 'x': col1, 'y': col2, 'type': 'scatter', 'mode': 'markers+lines', 'hoverinfo': 'label', 'label': 'Zoom Background Interest' }])
def process_geo_map(): df = process_input() df[df.columns[1]] = pd.to_numeric(df[df.columns[1]]) df[df.columns[2]] = pd.to_numeric(df[df.columns[2]]) col1 = df[df.columns[1]].values col2 = df[df.columns[2]].values col3 = df[df.columns[3]].values Plotly.plot(document.getElementById('plot4'), [{ 'type': 'scattergeo', 'lon': col2, 'lat': col1, 'text': col3 }])
def process_3d_maps(): df = process_input() col0 = df[df.columns[0]].values col1 = df[df.columns[1]].values col2 = df[df.columns[2]].values col3 = df[df.columns[3]].values col4 = df[df.columns[4]].values col5 = df[df.columns[5]].values Plotly.plot(document.getElementById('plot6'), [{ 'x': col0, 'y': col1, 'z': col2, 'mode': 'markers', 'marker': { 'size': 12, 'line': { 'color': 'rgba(217, 217, 217, 0.14)', 'width': 0.5 }, 'opacity': 0.8 }, 'type': 'scatter3d' }, { 'x': col3, 'y': col4, 'z': col5, 'mode': 'markers', 'marker': { 'color': 'rgb(127, 127, 127)', 'size': 12, 'symbol': 'circle', 'line': { 'color': 'rgb(204, 204, 204)', 'width': 1 }, 'opacity': 0.8 }, 'type': 'scatter3d' }], {'margin': { 'l': 0, 'r': 0, 'b': 0, 't': 0 }})
def process_heat_maps(): df = process_input() df[df.columns[0]] = pd.to_numeric(df[df.columns[0]]) df[df.columns[1]] = pd.to_numeric(df[df.columns[1]]) df[df.columns[2]] = pd.to_numeric(df[df.columns[2]]) col0 = df[df.columns[0]].values col1 = df[df.columns[1]].values col2 = df[df.columns[2]].values col3 = df[df.columns[3]].values col4 = df[df.columns[4]].values Plotly.plot(document.getElementById('plot5'), [{ 'z': [col0, col1, col2], 'x': col3, 'y': col4, 'type': 'heatmap', 'hoverongaps': 'false' }])
def process_time_series(): df = process_input() df[df.columns[1]] = pd.to_numeric(df[df.columns[1]]) df[df.columns[2]] = pd.to_numeric(df[df.columns[2]]) df[df.columns[3]] = pd.to_numeric(df[df.columns[3]]) col1 = df[df.columns[0]].values col2 = df[df.columns[1]].values col3 = df[df.columns[2]].values col4 = df[df.columns[3]].values Plotly.plot(document.getElementById('plot3'), [{ 'x': col1, 'y': col2, 'type': 'scatter', 'mode': "lines", 'name': 'Pho', 'line': { 'color': '#17BECF' } }, { 'x': col1, 'y': col3, 'type': "scatter", 'mode': "lines", 'name': 'Ramen', 'line': { 'color': '#7F7F7F' } }, { 'x': col1, 'y': col4, 'type': "scatter", 'mode': "lines", 'name': 'Soba', 'line': { 'color': '#7C19E2' } }])