Skip to content

examples/showcase/xkcd.py does not show line randomization on Mac OS X #2269

Closed

Description

Running the xkcd.py does not show the randomized lines as on the pics shown on the matplotlib homepage. The Comic font, however, is shown. See the images below. This is verified on OS X 10.7.5 and OS X 10.8.? with Python 2.7.5 and Python 3.3.2, matplotlib installed from the just released tar.

# python 
Python 2.7.5 (v2.7.5:ab05e7dd2788, May 13 2013, 13:18:45) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import matplotlib
>>> matplotlib.__version__
'1.3.0'
>>> quit()
# cd matplotlib-1.3.0/examples/showcase
# python xkcd.py

screen shot 2013-08-01 at 18 05 53
screen shot 2013-08-01 at 18 05 55

Activity

  1. mdboom commented on Aug 1, 2013

    @mdboom
    Member

    Which backend? Try one of the *Agg backends...

  2. mdboom commented on Aug 1, 2013

    @mdboom
    Member

    Thanks. We still may want to document this shortcoming better.

  3. DanHickstein commented on Sep 4, 2013

    @DanHickstein
    Contributor

    Thanks! This helped me get it working as well. I think that you actually are not using the super-awesome XKCD "humor sans" font (it looks a little more "hand drawn" than what you have on your plots). You need to install it (http://xkcdsucks.blogspot.com/2009/03/xkcdsucks-is-proud-to-present-humor.html) and then delete your ~/.matplotlib/fontList.cache file. Then matplotlib can find the humor sans font.

  4. ElDeveloper commented on Dec 16, 2013

    @ElDeveloper

    👍

  5. starfleetjames commented on Mar 10, 2014

    @starfleetjames

    I went through all the hassle of trying to install PyQT, which requires Qt, which requires SIP, in order to follow the fix here. But then I figured out that any Agg backend will do the trick. TkAgg still allows the use of interactive Python, so I went with that one. So all I add to my code is

    import matplotlib
    matplotlib.use('TkAgg')

    and I don't have to install any other wacky stuff, and it works from a script or iPython. Then I get plots that look nice and wavy!
    figure_1

  6. stared commented on Apr 2, 2014

    @stared

    For me removing font cache solved the problem (there was no need to use any other backend), see http://stackoverflow.com/questions/19663986/getting-xkcd-plots-using-matplotlib, so +1 for @DanHickstein .

  7. gcmartinelli commented on May 14, 2014

    @gcmartinelli

    Thank you @jmason86, your solution worked for me

  8. lanpa commented on Jul 16, 2014

    @lanpa

    I also solved the problem using jmason86's solution.

  9. xiumingzhang commented on Nov 8, 2015

    @xiumingzhang

    jmason86's solution saved me much trouble going through all those hassle. Thanks Mason!

  10. liangz0707 commented on Nov 30, 2015

    @liangz0707

    With following code my circle is also rendered as regular plots . There should be a bad circle, isn't it ?

    matplotlib.use('QT4Agg')
    patches = []
    fig, ax = plt.subplots()
    circle = Circle((0.2, 0.12), 0.1)
    patches.append(circle)
    p = PatchCollection(patches)
    ax.add_collection(p)
    plt.show()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions