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

Question:

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?

Asked By: hacking_mike

||

Answers:

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])

Answered By: Rob Raymond
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.