matplotlib._cntr.Cntr gone in 2.2

Hi all,

matplotlib._cntr.Cntr is gone in version 2.2. I know this was a private
module but it ended up being used by some (a quick online search will
show you some examples. ie this SO post:
https://stackoverflow.com/questions/18304722/python-find-contour-lines-from-matplotlib-pyplot-contour).

The use case for this class (as shown by the examples online) was to
obtain polygon contours of labeled regions in a 2D array.
Is there an alternative implementation available? The solutions I've
found online imply making a plot, which isn't really what I'm looking for.

Thanks a lot!

Fabien

Fabien,

I suggest looking at skimage (
Contour finding — skimage 0.23.0rc0.dev0 documentation )
for contouring code.

If you are absolutely dependent on that API, the source is available from
previous releases and you are welcome to vendor or create a stand-alone
library (not sure how hard that would actually be).

Please do not use private APIs. We can (and will!) change them with no
notice.

Tom

···

On Mon, Mar 5, 2018 at 3:45 AM Fabien <fabien.maussion at gmail.com> wrote:

Hi all,

matplotlib._cntr.Cntr is gone in version 2.2. I know this was a private
module but it ended up being used by some (a quick online search will
show you some examples. ie this SO post:

python - Find contour lines from matplotlib.pyplot.contour() - Stack Overflow
).

The use case for this class (as shown by the examples online) was to
obtain polygon contours of labeled regions in a 2D array.
Is there an alternative implementation available? The solutions I've
found online imply making a plot, which isn't really what I'm looking for.

Thanks a lot!

Fabien

_______________________________________________
Matplotlib-users mailing list
Matplotlib-users at python.org
Matplotlib-users Info Page

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/matplotlib-users/attachments/20180305/a12f7b43/attachment.html&gt;

Hi Thomas,

I suggest looking at skimage (
Contour finding — skimage 0.23.0rc0.dev0 documentation) for
contouring code.

Thanks! Looks like this is exactly what I was looking for. It's probably
not around since as long as matplotlib and therefore not prominent on
the forums dealing with the question. Thanks a lot!

Please do not use private APIs.? We can (and will!) change them with no
notice.

You are right, but... :wink:

Best,

Fabien

···

On 03/05/2018 03:03 PM, Thomas Caswell wrote:

For the record (and to my own surprise), it seems that skimage and the
deprecated Cntr are producing *exactly* the same results (appart from
the order of the vertices of course). I haven't tested it in all
possible cases of course, but changing to skimage simplified the code
and passed through all our tests.

Thanks!

Fabien

···

On 03/05/2018 03:03 PM, Thomas Caswell wrote:

I suggest looking at skimage (
Contour finding — skimage 0.23.0rc0.dev0 documentation)
for contouring code.