Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to solve: 'PathCollection' object has no attribute 'get_offset_position'

I try to test a simple Plotly examaple but I run into this error.
My code is just this:

import matplotlib.pyplot as plt
from plotly.tools import mpl_to_plotly

mpl_fig, ax = plt.subplots()
ax.scatter(x=[1, 2, 3], y=[23, 12, 34])
plotly_fig = mpl_to_plotly(mpl_fig)
plotly_fig

Can someone help me out here?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

See /mpl-to-plotly-limitations. It’s really not supported or maintained. I’d recommend going straight to plotly with the data:

import matplotlib.pyplot as plt
from plotly.tools import mpl_to_plotly
import plotly.express as px

# mpl_fig, ax = plt.subplots()
# ax.scatter(x=[1, 2, 3], y=[23, 12, 34])
# plotly_fig = mpl_to_plotly(mpl_fig)
# # plotly_fig

px.scatter(x=[1, 2, 3], y=[23, 12, 34])

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading