Bug report
Sketch transformation has identical pseudo-random output for identical inputs
The sketch transformation (such as used in xkcd) produces exactly the same randomized result if the same path is plotted repeatedly. This is visible especially in the legend, where the rectangle patch is repeated for each item. I exaggerated randomness and scale to make the effect better visible.
As far as I can see, the culprit is in the built-in RNG which gets re-seeded to 0 for each Sketch instantionation:
.
import matplotlib.pyplot as plt
with plt.xkcd(randomness=40,scale=1):
import matplotlib
from matplotlib import gridspec
pat,txt=plt.pie([10,20,30,40],wedgeprops={'edgecolor':'black'})
plt.legend(pat,['first','second','third','fourth'],loc='best')
Actual outcome

zoom on the legend:

Expected outcome
Shapes are distored randomly, e.g. each rectangle in the legend is different.
Matplotlib version
- Operating system: Ubuntu 18.04
- Matplotlib version: 2.2.2
- Matplotlib backend (
print(matplotlib.get_backend())): TkAgg
- Python version: 3.6.7
- Jupyter version (if applicable): [none]
- Other libraries:
installation: default packaged matplotlib installation (python3-matplotlib).
Bug report
Sketch transformation has identical pseudo-random output for identical inputs
The sketch transformation (such as used in xkcd) produces exactly the same randomized result if the same path is plotted repeatedly. This is visible especially in the legend, where the rectangle patch is repeated for each item. I exaggerated randomness and scale to make the effect better visible.
As far as I can see, the culprit is in the built-in RNG which gets re-seeded to 0 for each Sketch instantionation:
matplotlib/src/path_converters.h
Line 941 in e02f2c5
Actual outcome

zoom on the legend:
Expected outcome
Shapes are distored randomly, e.g. each rectangle in the legend is different.
Matplotlib version
print(matplotlib.get_backend())): TkAgginstallation: default packaged matplotlib installation (python3-matplotlib).