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

Return arrow collection as 2nd argument of streamplot.#803

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

Merged

Conversation

tonysyu
Copy link
Contributor

Return arrow patches so users can modify or remove them after callingstreamplot. This was listed as a todo in the original implementation, but never actually done.

Maybe adding arrows to the axes should be delayed until the arrow collection is completely populated (and then the collection can be added to the axes all at once, just like the streamline collection)?

@efiring
Copy link
Member

I don't think this is a good idea; what is really needed is some sort of compound mappable artist. It doesn't have to be a new kind of collection, but it needs to be a single ScalarMappable so that when sci() is used and the colormap is changed, the lines and arrows change together.
Also, when a cmap kwarg is allowed, a norm kwarg should also be allowed.

@tonysyu
Copy link
ContributorAuthor

Hmm,... I was hoping it wouldn't come to that :)

I guess I'll take a look at the ContourSet object (as you suggested in the original streamplot PR) and emulate it's behavior.

BTW, after looking back at the original PR, I realized never flagged the streamplot function as experimental, as you suggested. I'm not really sure where that should be marked. Maybe in the return value itself (assuming that's the only major part that's likely change)?

@efiring
Copy link
Member

The ContourSet is a model in the sense that it produces and contains more than a single primitive Artist, and in that it requires extensive computation to generate those Artists, but it may not be an ideal model. It evolved a long time ago. It is possible that the Container base class would provide a good starting point. This is just speculation, though; I haven't looked closely.

@tonysyu
Copy link
ContributorAuthor

In the newest PR,streamplot returns aContainer object with lines and arrows. This needs careful review because I had to override the__new__ constructor which didn't play well withCollections. I don't really understand the container object (e.g. why does it subclasstuple?), so I could be breaking something with this hack.

@leejjoon
Copy link
Contributor

The original purpose of the Container object was to support legend for complex plot commands. For example, errorbar command used to return a tuple of artists, thus I ended up with a simple Container class inherited from tuple. And it never meant to be a full implementation of artist.

I'm not sure what the streamplot need to return. Maybe a single object of a class inherited from a ScallarMappable (and Artist). And I think it might not be a good idea to use the Container class for this purpose.

@tonysyu
Copy link
ContributorAuthor

Thanks for your comments,@leejjoon. After rereading@efiring's comments, I realize that he suggested thatContainer would be a good starting point---not necessarily the base class for a streamplot container.

In my most recent commit, I change the base class to a simple object and give it attributeslines andarrows. As mentioned in the commit message, this is just a temporary fix since this object doesn't allow the user to set the properties of the lines and arrows from the object itself. Nevertheless, it does at least give users access to the arrows, and (I think) future changes (e.g. subclassingScalarMappable andArtist) could be made backward-compatible with this simple object.

@efiring
Copy link
Member

@tonysu, sorry for the extra work, but would you rebase this against master, please? Then I will merge it. I should have done so a long time ago. It definitely needs to be done before the RC.

@efiring
Copy link
Member

@tonysyu, also, while you are at it, you might want to note, in docstrings, and/or comments, something about the limitations and likely evolution.

- Return object that derives from `object` since deriving from `Container` was not beneficial.- This return value is a stopgap; the final return value should allow users to set the colormap, alpha, etc. for both lines and arrows.
@tonysyu
Copy link
ContributorAuthor

@efiring Rebased and added note about future changes tostreamplot return value.

@tonysyu
Copy link
ContributorAuthor

Hmm, Github seems to be screwing up the order of the commits. The discussion page for this PR shows commits in order: 1, 3, 2, 4. The commit page shows them in sequential order, and the diff page looks fine so it's probably just a bug in the discussion page.

@travisbot
Copy link

This pull requestfails (mergeda7248d9 intocadd152).

efiring added a commit that referenced this pull requestSep 2, 2012
Return arrow collection as 2nd argument of streamplot.
@efiringefiring merged commit7a61238 intomatplotlib:masterSep 2, 2012
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

5 participants
@tonysyu@efiring@leejjoon@travisbot@pelson

[8]ページ先頭

©2009-2025 Movatter.jp