BUG: showcase textspiral, assignment destination is read-only

Author: toshiakiasakuraCreated Jan 20, 2023Updated Feb 2, 2023

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

I tried to run the following code.

python
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.

Source: rougier/scientific-visualization-book