Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Legend shows arrow from annotate #8236#13034

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed
Wojciech-Lange wants to merge29 commits intomatplotlib:mainfromWojciech-Lange:feature

Conversation

Wojciech-Lange
Copy link

@Wojciech-LangeWojciech-Lange commentedDec 21, 2018
edited by dstansby
Loading

PR Summary

Answer for#8236 issue. Legend automatically handles an arrow from annotate. In fact the code is a limited variant of#10688 . FancyArrowPatch and HandlerAnnotation added. There might be some relicts left from the wider solution (#10688).

Example code:

importmatplotlib.pylabaspltfrommatplotlib.patchesimportFancyArrowPatchfrommatplotlib.legend_handlerimportHandlerAnnotationfig,ax=plt.subplots(1)ax.plot([0,1], [0,0],label='line1')ax.plot([0,1], [1,1],label='line2')ax.annotate("",xy=(0.3,1.0),xytext=(0.3,0.0),arrowprops={'arrowstyle':'<->','color':'C7' },label='distance')ax.legend()plt.show()

example

PR Checklist

  • Code isFlake 8 compliant
  • Example in examples folder
  • (probably) Documentation is sphinx and numpydoc compliant

eccyan reacted with thumbs up emoji
Copy link
Member

@dstansbydstansby left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

👍 Thanks for submitting this PR! Overall it looks good, I have added a couple of comments for code style changes. There are also a couple of test failures that need fixing - let us know if you need any more help with that.


HandlerBase.__init__(self, **kwargs)

def create_artists(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Could the call aruguments be on multiple lines, but with a maximum line length of 79 characters? (if that makes sense; like

deffunc(arg1,arg2,arg3,arg4,arg5)

handler = HandlerFancyArrowPatch()
handle = orig_handle.arrow_patch

return handler.create_artists(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Same as above regarding the function arguments here.

@dstansbydstansby added this to thev3.1 milestoneDec 28, 2018
@@ -32,7 +32,8 @@
from matplotlib.cbook import silent_list, is_hashable, warn_deprecated
from matplotlib.font_manager import FontProperties
from matplotlib.lines import Line2D
from matplotlib.patches import Patch, Rectangle, Shadow, FancyBboxPatch
from matplotlib.patches import (Patch, Rectangle, Shadow, FancyBboxPatch,
FancyArrowPatch)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Please align inside of the opening parenthesis.

# support parasite axes:
if hasattr(ax, 'parasites'):
for axx in ax.parasites:
handles_original += (axx.lines + axx.patches +
axx.collections + axx.containers)
axx.collections + axx.containers+ax.texts)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

shouldn't that beaxx.texts?

@jklymakjklymak modified the milestones:v3.1.0,unassignedFeb 10, 2019
@jklymak
Copy link
Member

@haloxxx this looks quite close, but it'd help if you addressed the comments above.

@Wojciech-Lange
Copy link
Author

@haloxxx this looks quite close, but it'd help if you addressed the comments above.

After these few months my request doesn't pass through checks. I've tried to apply all the suggestions, but I'm not sure if I can handle this by myself.

@jklymak
Copy link
Member

You have a syntax error. Presumably that is straightforward to fix. Did you try running your example script before pushing the new commits? 😉

@tacaswell
Copy link
Member

You may also need to rebase this on current master to pick up the fixes / changes to the doc build.

@tacaswelltacaswell modified the milestones:unassigned,v3.4.0Oct 2, 2020
@QuLogicQuLogic modified the milestones:v3.4.0,v3.5.0Jan 22, 2021
@jklymakjklymak marked this pull request as draftMarch 27, 2021 17:46
@QuLogicQuLogic modified the milestones:v3.5.0,v3.6.0Aug 18, 2021
@timhoffmtimhoffm modified the milestones:v3.6.0,unassignedApr 30, 2022
@oscargusoscargus mentioned this pull requestMay 29, 2022
6 tasks
@story645story645 modified the milestones:unassigned,needs sortingOct 6, 2022
@dstansby
Copy link
Member

I'm going to close this in favour of#23160, which is an updated version of this PR.

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

@timhoffmtimhoffmtimhoffm left review comments

@dstansbydstansbydstansby left review comments

Assignees
No one assigned
Projects
None yet
Milestone
future releases
Development

Successfully merging this pull request may close these issues.

9 participants
@Wojciech-Lange@jklymak@QuLogic@tacaswell@dstansby@timhoffm@story645@oscargus@haloxxx

[8]ページ先頭

©2009-2025 Movatter.jp