Skip to content

path randomness is repetitive (sketch RNG seeded to 0 for each path anew) #13479

@eudoxos

Description

@eudoxos

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
image

zoom on the legend:

image

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    keepItems to be ignored by the “Stale” Github Action

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy