0

I am trying to export the html of a graph using mpld3

import matplotlib.pyplot as plt, mpld3
obj, = plt.plot([3,1,4,1,5], 'ks-', mec='w', mew=5, ms=20)
mpld3.save_html(obj,'C:\\Users\\prabhat.mishra\\Desktop\\figure.html')


Facing Issue as AttributeError: 'Line2D' object has no attribute 'canvas

prabhat mishra
  • 202
  • 2
  • 14

1 Answers1

0

Figured out the solution:

import matplotlib.pyplot as plt, mpld3
fig = plt.figure()
obj, = plt.plot([3,1,4,1,5])
mpld3.save_html(fig,"C:\\Users\\prabhat.mishra\\Desktop\\figure1.html")

You need to pass figure object to save_html

prabhat mishra
  • 202
  • 2
  • 14