hey assistent
- User
hey assistent
- Assistant
Hello! How can I assist you today? 😊
- User
I have this if st.session_state.at_selected: new_multiaxisplot( Data_concat, "Acceleration Pedal [%]", "Vehicle Speed [kph]" ) elif st.session_state.mt_selected: fig = go.Figure() st.plotly_chart(fig) where Data_concat is Data_concat = Data_concat[ [ "Time [s]", "Vehicle Speed [kph]", "Acceleration Pedal [%]", "Veh Acceleration [m/s²]", "Clutch Pedal [%]", "Engine Speed [rpm]", "Veh Acceleration Filtred[m/s²]", "Accel_Pedal_Gradient", ] ] I want to complete the elif but using plotly becouse I want to have Acceleariton pedal, vechile speed and Clutch pedal
- Assistant
- User
yeah it looks kinda weird becouse new_multiaxisplot( Data_concat, "Acceleration Pedal [%]", "Vehicle Speed [kph]" ) was more clearer,
- Assistant
- User
def new_multiaxisplot(df, select_left, select_right): fig = figure(height=400, width=1200)
# Define x-axis fig.xaxis.axis_label = "Time [s]" # Define 1st LHS y-axis fig.yaxis.axis_label = select_left fig.y_range = Range1d(start=df[select_left].min(), end=df[select_left].max()) # fig.add_layout(LinearAxis(y_range_name='Pedal', axis_label=select_left), 'left') # Create 2nd LHS y-axis fig.extra_y_ranges["temp"] = Range1d( start=df[select_right].min(), end=df[select_right].max() ) fig.add_layout(LinearAxis(y_range_name="temp", axis_label=select_right), "left") # Create 1st RHS y-axis fig.extra_y_ranges["lflow"] = Range1d( start=df["Veh Acceleration Filtred[m/s²]"].min(), end=df["Veh Acceleration Filtred[m/s²]"].max(), ) fig.add_layout( LinearAxis(y_range_name="lflow", axis_label="Veh Acceleration Filtred[m/s²]"), "right", ) # # Create 2nd RHS y-axis # fig.extra_y_ranges['gflow'] = Range1d(start=0, end=50) # fig.add_layout(LinearAxis(y_range_name='gflow', axis_label='Gas Flowrate [MMscf/day]'), 'right') m = [] r1 = fig.line( x=df.index / 100, y=df[select_left], width=3, # y_range_name = 'Pedal', color="blue", ) m.append((select_left, [r1])) r2 = fig.line( x=df.index / 100, y=df[select_right], y_range_name="temp", color="red" ) m.append((select_right, [r2])) r3 = fig.line( x=df.index / 100, y=df["Veh Acceleration Filtred[m/s²]"], y_range_name="lflow", color="purple", ) m.append(("Veh Acceleration Filtred[m/s²]", [r3])) legend = Legend(items=m, location=(0, 0)) legend.visible = True fig.add_layout(legend, "right") fig.toolbar_location = "right" fig.legend.click_policy = "hide" # fig.tools = 'crosshair,reset' hover = HoverTool( tooltips=[ ("X", "@x"), # Display the x-coordinate (petal length) ( "Y", "@y", ), # Display the y-coordinate (petal width) # Display the species name ], renderers=[r1, r2, r3], # Apply the hover tool to this specific renderer ) # Add the hover tool to the figure fig.add_tools(hover) st.write(fig) - Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.