Closed iamsaswata closed 2 years ago
Thansk for report. Probably vertices are now read only. So we need to first make a copy and then re-assign the new vertices. Do you want to try to fix it and make a PR?
Thanks for motivating to look into the problem. Yes, you are correct about the read only mode of path vertices in newer matplotlib versions. I found that instead of creating a new vertices, we can just set the state of path vertices to "writeable" from "read only" state. I tested this with few (3.5.1, 3.1.1) matplotlib versions and it works as expected. Also made a PR of this fix. You may look into the PR and let me know your thoughts on it.
Thank you for the excellent book.
I am getting errors in the text-polar.py from the chapter scales-projections.
The error is:
ValueError Traceback (most recent call last) Input In [804], in
57 ax.add_artist(patch)
60 # This could be made through a list but it is easier to red this way
---> 61 label("JANUARY", 0.5 2 np.pi / 12, 1 - 0.5 size)
62 label("FEBRUARY", 1.5 2 np.pi / 12, 1 - 0.5 size)
63 label("MARCH", 2.5 2 np.pi / 12, 1 - 0.5 * size)
Input In [804], in label(text, angle, radius, scale) 48 xmin, xmax = V[:, 0].min(), V[:, 0].max() 49 ymin, ymax = V[:, 1].min(), V[:, 1].max() ---> 50 V -= (xmin + xmax) / 2, (ymin + ymax) / 2 51 V *= scale 52 for i in range(len(V)):
ValueError: output array is read-only
I am using numpy version 1.22.0 and matplotlib version 3.5.1