Skip to content

xkcd plots stopped working on Mac OS X. #5049

Closed

Description

@mario-grgic

The matplotlib xkcd example plots at

http://matplotlib.org/examples/showcase/xkcd.html

stopped working with matplotlib 1.4.x (they used to work with earlier versions). This is with Python 2.7.5 on Mac OS X 10.9.5 and matplotlib 1.4.3.

The following Traceback is printed if I run one of the examples:

Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/matplotlib/artist.py", line 59, in draw_wrapper
    draw(artist, renderer, *args, **kwargs)
  File "/Library/Python/2.7/site-packages/matplotlib/figure.py", line 1085, in draw
    func(*args)
  File "/Library/Python/2.7/site-packages/matplotlib/artist.py", line 59, in draw_wrapper
    draw(artist, renderer, *args, **kwargs)
  File "/Library/Python/2.7/site-packages/matplotlib/axes/_base.py", line 2110, in draw
    a.draw(renderer)
  File "/Library/Python/2.7/site-packages/matplotlib/artist.py", line 59, in draw_wrapper
    draw(artist, renderer, *args, **kwargs)
  File "/Library/Python/2.7/site-packages/matplotlib/lines.py", line 715, in draw
    drawFunc(renderer, gc, tpath, affine.frozen())
  File "/Library/Python/2.7/site-packages/matplotlib/lines.py", line 1072, in _draw_lines
    self._lineFunc(renderer, gc, path, trans)
  File "/Library/Python/2.7/site-packages/matplotlib/lines.py", line 1112, in _draw_solid
    renderer.draw_path(gc, path, trans)
  File "/Library/Python/2.7/site-packages/matplotlib/patheffects.py", line 115, in draw_path
    rgbFace)
  File "/Library/Python/2.7/site-packages/matplotlib/patheffects.py", line 217, in draw_path
    renderer.draw_path(gc, tpath, affine, rgbFace)
  File "/Library/Python/2.7/site-packages/matplotlib/backends/backend_macosx.py", line 58, in draw_path
    gc.draw_path(path, transform, linewidth, rgbFace)
AttributeError: GraphicsContextBase instance has no attribute 'draw_path'
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/matplotlib/artist.py", line 59, in draw_wrapper
    draw(artist, renderer, *args, **kwargs)
  File "/Library/Python/2.7/site-packages/matplotlib/figure.py", line 1085, in draw
    func(*args)
  File "/Library/Python/2.7/site-packages/matplotlib/artist.py", line 59, in draw_wrapper
    draw(artist, renderer, *args, **kwargs)
  File "/Library/Python/2.7/site-packages/matplotlib/axes/_base.py", line 2110, in draw
    a.draw(renderer)
  File "/Library/Python/2.7/site-packages/matplotlib/artist.py", line 59, in draw_wrapper
    draw(artist, renderer, *args, **kwargs)
  File "/Library/Python/2.7/site-packages/matplotlib/axis.py", line 1119, in draw
    tick.draw(renderer)
  File "/Library/Python/2.7/site-packages/matplotlib/artist.py", line 59, in draw_wrapper
    draw(artist, renderer, *args, **kwargs)
  File "/Library/Python/2.7/site-packages/matplotlib/axis.py", line 244, in draw
    self.tick1line.draw(renderer)
  File "/Library/Python/2.7/site-packages/matplotlib/artist.py", line 59, in draw_wrapper
    draw(artist, renderer, *args, **kwargs)
  File "/Library/Python/2.7/site-packages/matplotlib/lines.py", line 760, in draw
    rgbaFace)
  File "/Library/Python/2.7/site-packages/matplotlib/patheffects.py", line 127, in draw_markers
    **kwargs)
  File "/Library/Python/2.7/site-packages/matplotlib/backend_bases.py", line 265, in draw_markers
    rgbFace)
  File "/Library/Python/2.7/site-packages/matplotlib/patheffects.py", line 115, in draw_path
    rgbFace)
  File "/Library/Python/2.7/site-packages/matplotlib/patheffects.py", line 217, in draw_path
    renderer.draw_path(gc, tpath, affine, rgbFace)
  File "/Library/Python/2.7/site-packages/matplotlib/backends/backend_macosx.py", line 58, in draw_path
    gc.draw_path(path, transform, linewidth, rgbFace)
AttributeError: GraphicsContextBase instance has no attribute 'draw_path'

Activity

  1. mdboom commented on Sep 11, 2015

    @mdboom
    Member

    Seems to be specific to the macosx backed. Cc: @mdehoon

  2. mdehoon commented on Sep 11, 2015

    @mdehoon
    Contributor

    Why, on line 217 in patheffects.py, is renderer.draw_path(gc, ...) being called on a RendererMac object while gc is a GraphicsContextBase instead of a GraphicsContextMac? I suspect a call to

            # Get the real renderer, not a PathEffectRenderer.
            if isinstance(renderer, PathEffectRenderer):
                renderer = renderer._renderer

    is missing, but it may be some deeper problem.

  3. tacaswell commented on Sep 12, 2015

    @tacaswell
    Member

    Is this related to #4024 ?

  4. added this to the milestone on Sep 12, 2015
  5. mdehoon commented on Sep 14, 2015

    @mdehoon
    Contributor

    @tacaswell I think what we are seeing here is a more fundamental issue. If we solve this one then #4024 will likely also be solved; the opposite is not true though.

  6. mdehoon commented on Oct 5, 2015

    @mdehoon
    Contributor

    The equivalent bug appears with the gtkcairo backend:

    File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib-0_unknown-py2.7-macosx-10.9-intel.egg/matplotlib/backends/backend_cairo.py", line 153, in draw_path
        ctx = gc.ctx
    AttributeError: 'GraphicsContextBase' object has no attribute 'ctx'
    

    The origin of the bug is the same: The gtkcairo renderer is used with a generic (GraphicsContextBase) graphics context instead of a GraphicsContextCairo graphics context.

  7. mdehoon commented on Oct 9, 2015

    @mdehoon
    Contributor

    Also broken in the same way with the GTK backend:

    AttributeError: 'GraphicsContextBase' object has no attribute 'gdkGC'
    

    and with the ps backend:

    AttributeError: 'GraphicsContextBase' object has no attribute 'shouldstroke'
    
  8. modified the milestones: , on Oct 9, 2015
  9. self-assigned this
    on Oct 9, 2015
  10. added a commit that references this issue on Oct 9, 2015
    bfab80e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions