Skip to content

Instantly share code, notes, and snippets.

@Raudcu
Created July 31, 2019 20:08
Show Gist options
  • Save Raudcu/9e1038a47fa3a99d9a583e8076ffc701 to your computer and use it in GitHub Desktop.
Save Raudcu/9e1038a47fa3a99d9a583e8076ffc701 to your computer and use it in GitHub Desktop.
import matplotlib.pyplot as plt
import plotly.graph_objs as go
import plotly.tools as tls
import numpy as np
fig, ax = plt.subplots()
x = np.linspace(0, 10)
ax.plot(x, np.sin(x), '--', linewidth=2)
ax.plot(x, np.cos(x), '--', linewidth=2)
plotly_fig = tls.mpl_to_plotly(fig)
plotly_fig['layout']['showlegend'] = True
fig = go.Figure(plotly_fig)
fig.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment