Spaces:
Runtime error
Runtime error
File size: 1,566 Bytes
e93c297 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
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
|