Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: showcase textspiral, assignment destination is read-only #80

Open
toshiakiasakura opened this issue Jan 20, 2023 · 1 comment
Open

Comments

@toshiakiasakura
Copy link
Contributor

I try to replicate shocase/text-spiral.py in my laptop.

I tried to run the following code.

import mpmath

mpmath.mp.dps = 15000
text = str(mpmath.pi)

path = TextPath((0, 0), text, size=6, ) #, prop=FontProperties(family="Source Serif Pro"))
#path.vertices.setflags(write=1)
Vx, Vy = path.vertices[:, 0], path.vertices[:, 1]
X = np.interp(Vx, L, T[:, 0]) + Vy * np.interp(Vx, L, O[:, 0])
Y = np.interp(Vx, L, T[:, 1]) + Vy * np.interp(Vx, L, O[:, 1])
Vx[...] = X
Vy[...] = Y

Then I encountered ValueError: assignment destination is read-only.
If I add the line path.vertices.setflags(write=1) right after path object is created,
I can reproduce the showcase.

I used matplotlib 3.6.3, which might be different behaviour for a default object editing permission (can be checked by path.vertices.flags) .

Hope this comment will help improve reproducibility.

@rougier
Copy link
Owner

rougier commented Feb 2, 2023

Thanks, I think you're right. Do you want to make a PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants