Spaces:
Runtime error
Runtime error
import pandas as pd | |
import plotly.graph_objects as go | |
from plotly_resampler import FigureResampler, FigureWidgetResampler | |
def plotly_plot(df, time_column, data_column, mittelwert): | |
if mittelwert > 0: | |
df[data_column] = df[data_column].rolling(mittelwert).mean() | |
fig = FigureWidgetResampler(go.Figure()) | |
fig.add_trace(go.Scatter(x=df[time_column], y=df[data_column], mode='lines', name=data_column)) | |
fig.update_layout( | |
xaxis=dict( | |
showline=True, | |
showgrid=True, | |
showticklabels=True, | |
linecolor='black', | |
linewidth=1.5, | |
ticks='outside', | |
tickfont=dict( | |
family='Arial', | |
size=14, | |
color='black' | |
), | |
), | |
yaxis=dict( | |
showgrid=True, | |
zeroline=True, | |
showline=True, | |
showticklabels=True, | |
linecolor='black', | |
linewidth=1.5, | |
ticks='outside', | |
tickfont=dict( | |
family='Arial', | |
size=14, | |
color='black' | |
), | |
), | |
autosize=True, | |
margin=dict( | |
autoexpand=True, | |
l=100, | |
r=20, | |
t=110, | |
), | |
showlegend=True, | |
plot_bgcolor='white' | |
) | |
return fig | |