Skip to content

WIP: Fix streamplot set - #2500

Closed
tonysyu wants to merge 3 commits into
matplotlib:masterfrom
tonysyu:fix-streamplot-set
Closed

tonysyu wants to merge 3 commits into
matplotlib:masterfrom
tonysyu:fix-streamplot-set

Conversation

@tonysyu

@tonysyu tonysyu commented Oct 6, 2013

Copy link
Copy Markdown
Contributor

Currently, streamplot returns a not-so-useful StreamplotSet containing the line and arrow collections drawn on the figure. One major problem was that the arrow collection created was never added to the axes (each arrow patch was added separately). Unfortunately, making the arrows a true PatchCollection is a bit difficult: FancyArrowPatch doesn't seem to play nice with PatchCollection.

To fix these issues this PR:

  • Uses FancyArrow instead of FancyArrowPatch
  • Makes StreamplotSet a CompositeCollection.

The consequences are that:

  • Tests break since the different arrow classes draw with different sizes and at different locations
  • arrowstyle needs to be deprecated as an argument to streamplot
  • CompositeCollection may be a bit too magical (it automatically delegates attribute access to sub-collections)

Alternatives:

  • Fix FancyArrowPatch to work with PatchCollection. This probably requires some transform knowledge that I'm missing.
  • Instead of CompositeCollection, just add some subset of collection methods/attrs that the set should support.

Note: Changes to pyplot.py were generated by boilerplate.py.

@WeatherGod

Copy link
Copy Markdown
Member

Hmmm, I think my vote would be to fix FancyArrowPatch. Although, I have to
say that the CompositeCollection implementation might be useful with my
LogicalCollection idea that I have been toying with.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Use the matplotlib deprecation warning (I think it is in cbook)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Actually, it is less a deprecation, more an outright removal, so I'd consider raising an Exception (others - does that fit with how you would do things here?)

@tacaswell

Copy link
Copy Markdown
Member

@tonysyu Where does this stand? In any case it needs a re-base again.

@tonysyu

tonysyu commented Jan 7, 2014

Copy link
Copy Markdown
Contributor Author

@tacaswell Thanks for bumping the PR. I'm not really sure where this stands, though. I submitted this PR to get feedback about some of the design decisions, but I don't think I'm any closer to reaching a conclusion.

In retrospect, I think CompositeCollection maybe a bit too magical, and unless it is useful in other code, it's a bit over engineered.

I really don't like breaking the API and replacing FancyArrow with FancyArrowPatch, but I don't know how much work would be involved in making FancyArrowPatch behave correctly.

@pelson

pelson commented Jan 9, 2014

Copy link
Copy Markdown
Member

Closing until @tonysyu is happy with the PR.

@pelson pelson closed this Jan 9, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants