Thomas,

The problem is not in the Polygon class, rather it is in the method

convert_path_to_polygons from _path.h in matplotlib 1.5dev1 and _path.cpp

in matplotlib 1.4.3 . I print the polygons result from converting the path

to polygon in the files attached. The polygons from this figure ->

https://andnovar.files.wordpress.com/2015/08/screenshot-from-2015-08-03-175714.png

There is something definitely not right from what you can see in the files.

What I did temporary is that when is version >= 1.5 it will not consider

the last two vertices which seems repeated in most of the cases.

I got another question as well, I am getting troubles with the onHilite

event (https://github.com/kivy-garden/garden.matplotlib/issues/19). I think

it is related to the TimerBase. Can anyone tell me a little bit more about

the TimerBase.

Thanks, Andres

Andres,

Have you made any progress on this?

Using the code in integral_demo.py

```
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.patches import Polygon
def func(x):
return (x - 3) * (x - 5) * (x - 7) + 85
a, b = 2, 9 # integral limits
# Make the shaded region
ix = np.linspace(a, b)
iy = func(ix)
verts = [(a, 0)] + list(zip(ix, iy)) + [(b, 0)]
poly = Polygon(verts, facecolor='0.9', edgecolor='0.5')
pth = poly.get_path()
```

which if you look at the vertices and codes on both 1.4.3 and current(ish)

master you get

```
In [73]: pth.vertices
Out[74]:
array([[ 2. , 0. ],
[ 2. , 70. ],
[ 2.14285714, 73.10495627],
[ 2.28571429, 75.86005831],
[ 2.42857143, 78.28279883],
[ 2.57142857, 80.39067055],
[ 2.71428571, 82.20116618],
[ 2.85714286, 83.73177843],
[ 3. , 85. ],
[ 3.14285714, 86.02332362],
[ 3.28571429, 86.81924198],
[ 3.42857143, 87.40524781],
[ 3.57142857, 87.79883382],
[ 3.71428571, 88.01749271],
[ 3.85714286, 88.0787172 ],
[ 4. , 88. ],
[ 4.14285714, 87.79883382],
[ 4.28571429, 87.49271137],
[ 4.42857143, 87.09912536],
[ 4.57142857, 86.63556851],
[ 4.71428571, 86.11953353],
[ 4.85714286, 85.56851312],
[ 5. , 85. ],
[ 5.14285714, 84.43148688],
[ 5.28571429, 83.88046647],
[ 5.42857143, 83.36443149],
[ 5.57142857, 82.90087464],
[ 5.71428571, 82.50728863],
[ 5.85714286, 82.20116618],
[ 6. , 82. ],
[ 6.14285714, 81.9212828 ],
[ 6.28571429, 81.98250729],
[ 6.42857143, 82.20116618],
[ 6.57142857, 82.59475219],
[ 6.71428571, 83.18075802],
[ 6.85714286, 83.97667638],
[ 7. , 85. ],
[ 7.14285714, 86.26822157],
[ 7.28571429, 87.79883382],
[ 7.42857143, 89.60932945],
[ 7.57142857, 91.71720117],
[ 7.71428571, 94.13994169],
[ 7.85714286, 96.89504373],
[ 8. , 100. ],
[ 8.14285714, 103.47230321],
[ 8.28571429, 107.32944606],
[ 8.42857143, 111.58892128],
[ 8.57142857, 116.26822157],
[ 8.71428571, 121.38483965],
[ 8.85714286, 126.95626822],
[ 9. , 133. ],
[ 9. , 0. ],
[ 2. , 0. ]])
In [75]: pth.codes
Out[75]:
array([ 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 79], dtype=uint8)
```

which is is both cases closed due to the `closed` kwarg on the `Polygon`

`__init__`, if you change this to `False` you get back open paths.

The backend API has not changed between 1.4.3 and current master, you

should be able to develop a backend which will work with both. If you have

found API breaks we would really like to know about them!

Tom

I can reproduce the problem with the GTK backend but not the GTKAgg or

GTKCairo backends. Unless you have some specific reason for using the GTK

backend I would strongly recommend against it. It is untested,

unmaintained and officially discouraged:

http://matplotlib.org/faq/usage_faq.html#what-is-a-backend I would

recommend you to use GTKAgg instead.

Furthermore the GDK toolkit, used in that backend, has been dropped from

GTK3 which officially uses Cairo internally and thus Matplotlib only

supports GTK3Agg and GTK3Cario

I guess the issue is likely a result of the large C++ refactoring in

master.

best

Jens

fre. 14. aug. 2015 kl. 15.21 skrev Thomas Caswell <tcaswell at gmail.com>:

Please keep all discussion on the mailing list (

matplotlib-devel at python.org).

Being pedantic about versions, current master is v1.5.0dev1 , not 1.5.1

(which will be the first bug fix release in the 1.5 series which may or may

not ever happen).

I don't have gtk installed to easily test this and it looks fine with

qt4agg, can you provide a minimal script and the code paths from a simple

polygon?

Tom

Hello Tom,

Thanks for your prompt reply. I am using the function

path.to_polygons() and that gives me a non-closed path in matplotlib 1.4.3

(last stable release) and give me a closed path in 1.5.1 (master from

github). You can see the problem if you run integral_demo.py with

matplotlib 1.5.1 master with matplotlib.use('gtk').

Thanks, Andres

Did you mean 1.4.1 instead of 1.5.1 ?

Exactly which paths are you looking at and how are you generating then

on the mpl side? We have many ways to generate the paths and there maybe

inconsistence in how closed paths are handled.

Tom

Hello,

My name is Andres I am developing a backend for kivy. I was initially

developing for 1.5.1 and I found that the paths are coming with the initial

vertex at the end of the list. Does anyone know whether this is change in

the way paths are sent ? and how can be fixed coming from 1.4.3 since I am

developing the backend for that version.

Thanks, Andres

------------------------------------------------------------------------------

_______________________________________________

Matplotlib-devel mailing list

Matplotlib-devel at lists.sourceforge.net

https://lists.sourceforge.net/lists/listinfo/matplotlib-devel

_______________________________________________

Matplotlib-devel mailing list

Matplotlib-devel at python.org

https://mail.python.org/mailman/listinfo/matplotlib-devel

-------------- next part --------------

An HTML attachment was scrubbed...

URL: <http://mail.python.org/pipermail/matplotlib-devel/attachments/20150909/2afd70a6/attachment-0001.html>

-------------- next part --------------

[array([[ 0., 0.],

[ 101., 0.]]), array([[ 0., 101.],

[ 0., 0.]])]

[array([[ 80., 48.],

[ 101., 48.]]), array([[ 80., 101.],

[ 80., 48.]])]

[array([[ 80., 48.],

[ 101., 48.]]), array([[ 80., 101.],

[ 80., 48.]])]

[array([[ 179.2, 48. ]])]

[array([[ 278.4, 48. ]])]

[array([[ 377.6, 48. ]])]

[array([[ 476.8, 48. ]])]

[array([[ 114.72, 48. ]])]

[array([[ 213.92, 48. ]])]

[array([[ 313.12, 48. ]])]

[array([[ 412.32, 48. ]])]

[array([[ 511.52, 48. ]])]

[array([[ 97.36, 220.8 ]])]

[array([[ 196.56, 355.2 ]])]

[array([[ 295.76, 297.6 ]])]

[array([[ 394.96, 374.4 ]])]

[array([[ 494.16, 288. ]])]

[array([[ 132.08, 259.2 ]])]

[array([[ 231.28, 307.2 ]])]

[array([[ 330.48, 355.2 ]])]

[array([[ 429.68, 211.2 ]])]

[array([[ 528.88, 259.2 ]])]

[array([[ 80., 432.]])]

[array([[ 576., 48.]])]

[array([[ 80., 48.],

[ 80., 101.]])]

[array([[ 80., 48.],

[ 101., 48.]])]

[array([[ 457.4, 369.2]])]

[array([[ 463.8, 401.6]])]

[array([[ 463.8, 376.6]])]

[array([[ 0., 0.],

[ 101., 0.]]), array([[ 0., 101.],

[ 0., 0.]])]

[array([[ 80., 48.],

[ 101., 48.]]), array([[ 80., 101.],

[ 80., 48.]])]

[array([[ 80., 48.],

[ 101., 48.]]), array([[ 80., 101.],

[ 80., 48.]])]

[array([[ 179.2, 48. ]])]

[array([[ 278.4, 48. ]])]

[array([[ 377.6, 48. ]])]

[array([[ 476.8, 48. ]])]

[array([[ 114.72, 48. ]])]

[array([[ 213.92, 48. ]])]

[array([[ 313.12, 48. ]])]

[array([[ 412.32, 48. ]])]

[array([[ 511.52, 48. ]])]

[array([[ 97.36, 220.8 ]])]

[array([[ 196.56, 355.2 ]])]

[array([[ 295.76, 297.6 ]])]

[array([[ 394.96, 374.4 ]])]

[array([[ 494.16, 288. ]])]

[array([[ 132.08, 259.2 ]])]

[array([[ 231.28, 307.2 ]])]

[array([[ 330.48, 355.2 ]])]

[array([[ 429.68, 211.2 ]])]

[array([[ 528.88, 259.2 ]])]

[array([[ 80., 432.]])]

[array([[ 576., 48.]])]

[array([[ 80., 48.],

[ 80., 101.]])]

[array([[ 80., 48.],

[ 101., 48.]])]

[array([[ 457.4, 369.2]])]

[array([[ 463.8, 401.6]])]

[array([[ 463.8, 376.6]])]

[array([[ 0., 0.],

[ 500., 0.],

[ 500., 450.],

[ 0., 450.],

[ 0., 0.]])]

[array([[ 62.5, 45. ],

[ 450. , 45. ],

[ 450. , 405. ],

[ 62.5, 405. ],

[ 62.5, 45. ]])]

[array([[ 62.5 , 45. ],

[ 89.625, 45. ],

[ 89.625, 225. ],

[ 62.5 , 225. ],

[ 62.5 , 45. ]])]

[array([[ 140. , 45. ],

[ 167.125, 45. ],

[ 167.125, 360. ],

[ 140. , 360. ],

[ 140. , 45. ]])]

[array([[ 217.5 , 45. ],

[ 244.625, 45. ],

[ 244.625, 315. ],

[ 217.5 , 315. ],

[ 217.5 , 45. ]])]

[array([[ 295. , 45. ],

[ 322.125, 45. ],

[ 322.125, 360. ],

[ 295. , 360. ],

[ 295. , 45. ]])]

[array([[ 372.5 , 45. ],

[ 399.625, 45. ],

[ 399.625, 288. ],

[ 372.5 , 288. ],

[ 372.5 , 45. ]])]

[array([[ 89.625, 45. ],

[ 116.75 , 45. ],

[ 116.75 , 270. ],

[ 89.625, 270. ],

[ 89.625, 45. ]])]

[array([[ 167.125, 45. ],

[ 194.25 , 45. ],

[ 194.25 , 333. ],

[ 167.125, 333. ],

[ 167.125, 45. ]])]

[array([[ 244.625, 45. ],

[ 271.75 , 45. ],

[ 271.75 , 351. ],

[ 244.625, 351. ],

[ 244.625, 45. ]])]

[array([[ 322.125, 45. ],

[ 349.25 , 45. ],

[ 349.25 , 225. ],

[ 322.125, 225. ],

[ 322.125, 45. ]])]

[array([[ 399.625, 45. ],

[ 426.75 , 45. ],

[ 426.75 , 270. ],

[ 399.625, 270. ],

[ 399.625, 45. ]])]

[array([[ 76.0625, 207. ],

[ 76.0625, 243. ]])]

[array([[ 153.5625, 333. ],

[ 153.5625, 387. ]])]

[array([[ 231.0625, 279. ],

[ 231.0625, 351. ]])]

[array([[ 308.5625, 351. ],

[ 308.5625, 369. ]])]

[array([[ 386.0625, 270. ],

[ 386.0625, 306. ]])]

[array([[ 103.1875, 243. ],

[ 103.1875, 297. ]])]

[array([[ 180.6875, 288. ],

[ 180.6875, 378. ]])]

[array([[ 258.1875, 333. ],

[ 258.1875, 369. ]])]

[array([[ 335.6875, 198. ],

[ 335.6875, 252. ]])]

[array([[ 413.1875, 243. ],

[ 413.1875, 297. ]])]

[array([[ 62.5, 405. ],

[ 450. , 405. ]])]

[array([[ 450., 45.],

[ 450., 405.]])]

[array([[ 62.5, 45. ],

[ 62.5, 405. ]])]

[array([[ 62.5, 45. ],

[ 450. , 45. ]])]

[array([[ 331.4, 342.2],

[ 442. , 342.2],

[ 442. , 397. ],

[ 331.4, 397. ],

[ 331.4, 342.2]])]

[array([[ 337.8, 374.6],

[ 369.8, 374.6],

[ 369.8, 385.8],

[ 337.8, 385.8],

[ 337.8, 374.6]])]

[array([[ 337.8, 349.6],

[ 369.8, 349.6],

[ 369.8, 360.8],

[ 337.8, 360.8],

[ 337.8, 349.6]])]

-------------- next part --------------

[array([[ 0., 0.],

[ 101., 0.],

[ 0., 0.],

[ 0., 0.]]), array([[ 0., 101.],

[ 0., 101.],

[ 0., 101.]]), array([[ 0., 0.],

[ 0., 0.]])]

[array([[ 80., 48.],

[ 101., 48.],

[ 80., 48.],

[ 80., 48.]]), array([[ 80., 101.],

[ 80., 101.],

[ 80., 101.]]), array([[ 80., 48.],

[ 80., 48.]])]

[array([[ 80., 48.],

[ 101., 48.],

[ 80., 48.],

[ 80., 48.]]), array([[ 80., 101.],

[ 80., 101.],

[ 80., 101.]]), array([[ 80., 48.],

[ 80., 48.]])]

[array([[ 179.2, 48. ],

[ 179.2, 48. ]])]

[array([[ 278.4, 48. ],

[ 278.4, 48. ]])]

[array([[ 377.6, 48. ],

[ 377.6, 48. ]])]

[array([[ 476.8, 48. ],

[ 476.8, 48. ]])]

[array([[ 114.72, 48. ],

[ 114.72, 48. ]])]

[array([[ 213.92, 48. ],

[ 213.92, 48. ]])]

[array([[ 313.12, 48. ],

[ 313.12, 48. ]])]

[array([[ 412.32, 48. ],

[ 412.32, 48. ]])]

[array([[ 511.52, 48. ],

[ 511.52, 48. ]])]

[array([[ 97.36, 220.8 ],

[ 97.36, 220.8 ]])]

[array([[ 196.56, 355.2 ],

[ 196.56, 355.2 ]])]

[array([[ 295.76, 297.6 ],

[ 295.76, 297.6 ]])]

[array([[ 394.96, 374.4 ],

[ 394.96, 374.4 ]])]

[array([[ 494.16, 288. ],

[ 494.16, 288. ]])]

[array([[ 132.08, 259.2 ],

[ 132.08, 259.2 ]])]

[array([[ 231.28, 307.2 ],

[ 231.28, 307.2 ]])]

[array([[ 330.48, 355.2 ],

[ 330.48, 355.2 ]])]

[array([[ 429.68, 211.2 ],

[ 429.68, 211.2 ]])]

[array([[ 528.88, 259.2 ],

[ 528.88, 259.2 ]])]

[array([[ 80., 432.],

[ 80., 432.]])]

[array([[ 576., 48.],

[ 576., 48.]])]

[array([[ 80., 48.],

[ 101., 48.],

[ 80., 48.]])]

[array([[ 80., 48.],

[ 80., 101.],

[ 80., 48.]])]

[array([[ 457.4, 369.2],

[ 457.4, 369.2]])]

[array([[ 463.8, 401.6],

[ 463.8, 401.6]])]

[array([[ 463.8, 376.6],

[ 463.8, 376.6]])]

[array([[ 0., 0.],

[ 101., 0.],

[ 0., 0.],

[ 0., 0.]]), array([[ 0., 101.],

[ 0., 101.],

[ 0., 101.]]), array([[ 0., 0.],

[ 0., 0.]])]

[array([[ 80., 48.],

[ 101., 48.],

[ 80., 48.],

[ 80., 48.]]), array([[ 80., 101.],

[ 80., 101.],

[ 80., 101.]]), array([[ 80., 48.],

[ 80., 48.]])]

[array([[ 80., 48.],

[ 101., 48.],

[ 80., 48.],

[ 80., 48.]]), array([[ 80., 101.],

[ 80., 101.],

[ 80., 101.]]), array([[ 80., 48.],

[ 80., 48.]])]

[array([[ 179.2, 48. ],

[ 179.2, 48. ]])]

[array([[ 278.4, 48. ],

[ 278.4, 48. ]])]

[array([[ 377.6, 48. ],

[ 377.6, 48. ]])]

[array([[ 476.8, 48. ],

[ 476.8, 48. ]])]

[array([[ 114.72, 48. ],

[ 114.72, 48. ]])]

[array([[ 213.92, 48. ],

[ 213.92, 48. ]])]

[array([[ 313.12, 48. ],

[ 313.12, 48. ]])]

[array([[ 412.32, 48. ],

[ 412.32, 48. ]])]

[array([[ 511.52, 48. ],

[ 511.52, 48. ]])]

[array([[ 97.36, 220.8 ],

[ 97.36, 220.8 ]])]

[array([[ 196.56, 355.2 ],

[ 196.56, 355.2 ]])]

[array([[ 295.76, 297.6 ],

[ 295.76, 297.6 ]])]

[array([[ 394.96, 374.4 ],

[ 394.96, 374.4 ]])]

[array([[ 494.16, 288. ],

[ 494.16, 288. ]])]

[array([[ 132.08, 259.2 ],

[ 132.08, 259.2 ]])]

[array([[ 231.28, 307.2 ],

[ 231.28, 307.2 ]])]

[array([[ 330.48, 355.2 ],

[ 330.48, 355.2 ]])]

[array([[ 429.68, 211.2 ],

[ 429.68, 211.2 ]])]

[array([[ 528.88, 259.2 ],

[ 528.88, 259.2 ]])]

[array([[ 80., 432.],

[ 80., 432.]])]

[array([[ 576., 48.],

[ 576., 48.]])]

[array([[ 80., 48.],

[ 101., 48.],

[ 80., 48.]])]

[array([[ 80., 48.],

[ 80., 101.],

[ 80., 48.]])]

[array([[ 457.4, 369.2],

[ 457.4, 369.2]])]

[array([[ 463.8, 401.6],

[ 463.8, 401.6]])]

[array([[ 463.8, 376.6],

[ 463.8, 376.6]])]

[array([[ 0., 0.],

[ 500., 0.],

[ 500., 450.],

[ 0., 450.],

[ 0., 0.],

[ 0., 0.],

[ 0., 0.]])]

[array([[ 62.5, 45. ],

[ 450. , 45. ],

[ 450. , 405. ],

[ 62.5, 405. ],

[ 62.5, 45. ],

[ 62.5, 45. ],

[ 62.5, 45. ]])]

[array([[ 62.5 , 45. ],

[ 89.625, 45. ],

[ 89.625, 225. ],

[ 62.5 , 225. ],

[ 62.5 , 45. ],

[ 62.5 , 45. ],

[ 62.5 , 45. ]])]

[array([[ 140. , 45. ],

[ 167.125, 45. ],

[ 167.125, 360. ],

[ 140. , 360. ],

[ 140. , 45. ],

[ 140. , 45. ],

[ 140. , 45. ]])]

[array([[ 217.5 , 45. ],

[ 244.625, 45. ],

[ 244.625, 315. ],

[ 217.5 , 315. ],

[ 217.5 , 45. ],

[ 217.5 , 45. ],

[ 217.5 , 45. ]])]

[array([[ 295. , 45. ],

[ 322.125, 45. ],

[ 322.125, 360. ],

[ 295. , 360. ],

[ 295. , 45. ],

[ 295. , 45. ],

[ 295. , 45. ]])]

[array([[ 372.5 , 45. ],

[ 399.625, 45. ],

[ 399.625, 288. ],

[ 372.5 , 288. ],

[ 372.5 , 45. ],

[ 372.5 , 45. ],

[ 372.5 , 45. ]])]

[array([[ 89.625, 45. ],

[ 116.75 , 45. ],

[ 116.75 , 270. ],

[ 89.625, 270. ],

[ 89.625, 45. ],

[ 89.625, 45. ],

[ 89.625, 45. ]])]

[array([[ 167.125, 45. ],

[ 194.25 , 45. ],

[ 194.25 , 333. ],

[ 167.125, 333. ],

[ 167.125, 45. ],

[ 167.125, 45. ],

[ 167.125, 45. ]])]

[array([[ 244.625, 45. ],

[ 271.75 , 45. ],

[ 271.75 , 351. ],

[ 244.625, 351. ],

[ 244.625, 45. ],

[ 244.625, 45. ],

[ 244.625, 45. ]])]

[array([[ 322.125, 45. ],

[ 349.25 , 45. ],

[ 349.25 , 225. ],

[ 322.125, 225. ],

[ 322.125, 45. ],

[ 322.125, 45. ],

[ 322.125, 45. ]])]

[array([[ 399.625, 45. ],

[ 426.75 , 45. ],

[ 426.75 , 270. ],

[ 399.625, 270. ],

[ 399.625, 45. ],

[ 399.625, 45. ],

[ 399.625, 45. ]])]

[array([[ 76.0625, 207. ],

[ 76.0625, 243. ],

[ 76.0625, 207. ]])]

[array([[ 153.5625, 333. ],

[ 153.5625, 387. ],

[ 153.5625, 333. ]])]

[array([[ 231.0625, 279. ],

[ 231.0625, 351. ],

[ 231.0625, 279. ]])]

[array([[ 308.5625, 351. ],

[ 308.5625, 369. ],

[ 308.5625, 351. ]])]

[array([[ 386.0625, 270. ],

[ 386.0625, 306. ],

[ 386.0625, 270. ]])]

[array([[ 103.1875, 243. ],

[ 103.1875, 297. ],

[ 103.1875, 243. ]])]

[array([[ 180.6875, 288. ],

[ 180.6875, 378. ],

[ 180.6875, 288. ]])]

[array([[ 258.1875, 333. ],

[ 258.1875, 369. ],

[ 258.1875, 333. ]])]

[array([[ 335.6875, 198. ],

[ 335.6875, 252. ],

[ 335.6875, 198. ]])]

[array([[ 413.1875, 243. ],

[ 413.1875, 297. ],

[ 413.1875, 243. ]])]

[array([[ 62.5, 405. ],

[ 450. , 405. ],

[ 62.5, 405. ]])]

[array([[ 450., 45.],

[ 450., 405.],

[ 450., 45.]])]

[array([[ 62.5, 45. ],

[ 450. , 45. ],

[ 62.5, 45. ]])]

[array([[ 62.5, 45. ],

[ 62.5, 405. ],

[ 62.5, 45. ]])]

[array([[ 331.4, 342.2],

[ 442. , 342.2],

[ 442. , 397. ],

[ 331.4, 397. ],

[ 331.4, 342.2],

[ 331.4, 342.2],

[ 331.4, 342.2]])]

[array([[ 337.8, 374.6],

[ 369.8, 374.6],

[ 369.8, 385.8],

[ 337.8, 385.8],

[ 337.8, 374.6],

[ 337.8, 374.6],

[ 337.8, 374.6]])]

[array([[ 337.8, 349.6],

[ 369.8, 349.6],

[ 369.8, 360.8],

[ 337.8, 360.8],

[ 337.8, 349.6],

[ 337.8, 349.6],

[ 337.8, 349.6]])]

## ···

On Tue, Sep 8, 2015 at 8:22 PM, Thomas Caswell <tcaswell at gmail.com> wrote:

On Fri, Aug 14, 2015 at 11:26 AM Jens Nielsen <jenshnielsen at gmail.com> > wrote:

On Fri, Aug 14, 2015 at 9:05 AM Andr?s Vargas <andnovar at gmail.com> >>> wrote:

On Fri, Aug 14, 2015 at 8:13 AM, Thomas Caswell <tcaswell at gmail.com> >>>> wrote:

On Wed, Aug 12, 2015, 1:57 PM Andr?s Vargas <andnovar at gmail.com> >>>>> wrote: