Skip to content

Path effects applied to annotation text containing \n #4024

Closed

Description

@dkirkby

I am using the following test program with mathplotlib 1.4.0 (via anaconda) on OS X 10.10.1:

import matplotlib.pyplot as plt
import matplotlib.patheffects as pe

plt.subplot(1,1,1)
plt.annotate('line1\nline2',xy=(0.5,0.5),xycoords='axes fraction',fontsize='x-large',
    path_effects=[pe.withStroke(linewidth=1,foreground='r')])
plt.show()

This fails with:

AttributeError: GraphicsContextBase instance has no attribute 'draw_path'

Removing the \n from the text or removing the path_effects option both run as expected. Any workarounds you can suggest are appreciated.

Activity

  1. added this to the milestone on Jan 22, 2015
  2. cimarronm commented on Mar 7, 2015

    @cimarronm
    Contributor

    Definitely a problem with the MacOS backend and probably affects other backends which use a stack-based graphics context

  3. cimarronm commented on Mar 8, 2015

    @cimarronm
    Contributor

    @dkirkby This should be resolved with PR #4201 and #4202.

    The workaround without these fixes applied is to separate out the annotation into separate annotations (without the newline).

  4. modified the milestones: , on May 15, 2015
  5. added 2 commits that reference this issue on Jun 19, 2015
    857a49c
    8c5a6e0
  6. jenshnielsen commented on Aug 6, 2015

    @jenshnielsen
    Member

    I don't think this is fixed for OSX so I will reopen #4542 fixed it for Cairo which caused this to auto close

  7. modified the milestones: , on Aug 9, 2015
  8. tacaswell commented on Aug 9, 2015

    @tacaswell
    Member

    not blocking 1.5 on this unless @mdehoon wants to.

  9. added a commit that references this issue on Oct 9, 2015
    bfab80e
  10. assigned and unassigned on Oct 9, 2015
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