Skip to content

Instantly share code, notes, and snippets.

@pierrelouisbescond
Last active September 11, 2022 09:05
Show Gist options
  • Save pierrelouisbescond/42e039c1e7c668cf977a0a55d3c1d7c9 to your computer and use it in GitHub Desktop.
Save pierrelouisbescond/42e039c1e7c668cf977a0a55d3c1d7c9 to your computer and use it in GitHub Desktop.
# We normalize x values to match with the 0-2π cycle
df["x_norm"] = 2 * math.pi * df["x"] / df["x"].max()
df["cos_x"] = np.cos(df["x_norm"])
display(df)
import plotly.graph_objects as go
fig = go.Figure()
fig.add_trace(go.Scatter(x=df.x_norm, y=df.cos_x))
fig.update_layout(yaxis=dict(scaleanchor="x", scaleratio=1))
fig.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment