0

I want to get axes of a matplotlib.collections.PolyCollection. If pc is such an object, running the code below:

ax = pc.axes.get_xaxis()

Though my code has been working before, I was encountering the warning below:

MatplotlibDeprecationWarning: get_axes has been deprecated in mpl 1.5, please use the axes property. A removal date has not been set.

But now I have encountered this error running the same program:

'PolyCollection' object has no attribute 'get_axes'

How can I get the axes after depreciation of the get_axes?

pouria babvey
  • 145
  • 2
  • 12
  • Can you please precisely state which code you are running and what the complete error traceback is. Also state the version you are using. – ImportanceOfBeingErnest Nov 13 '18 at 13:03
  • My code is a modified version of this code available on StackOverflow: https://stackoverflow.com/questions/25071968/heatmap-with-text-in-each-cell-with-matplotlibs-pyplot/25074150#25074150 – pouria babvey Nov 13 '18 at 15:54

1 Answers1

2

The warning you mention suggests to use the axes property instead. Having a look at the documentation, axes is an existing property while get_axes is not. It should return the Axes instance as intended.

Patol75
  • 4,342
  • 1
  • 17
  • 28