Skip to content

Add norm parameter to streamplot. - #849

Merged
WeatherGod merged 3 commits into
matplotlib:masterfrom
tonysyu:streamplot-norm-param
Apr 30, 2012
Merged

WeatherGod merged 3 commits into
matplotlib:masterfrom
tonysyu:streamplot-norm-param

Conversation

@tonysyu

@tonysyu tonysyu commented Apr 22, 2012

Copy link
Copy Markdown
Contributor

As suggested by @efiring: "when a cmap kwarg is allowed, a norm kwarg should also be allowed."

Also, fixed/enhanced some docstrings.

Comment thread lib/matplotlib/streamplot.py Outdated

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.

Why not prepare for future changes by simply returning a one-element list? Future revisions could then have the arrow patches as the next item in the list without breaking anyone existing code?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'm not actually sure what the future return value will look like. A two-item list sounds a bit like what I implemented in PR #803, but @efiring suggested a different approach---possibly using the Container class. Based on the subclasses in matplotlib.container, it seems a Container-based return value may look (to the user) like a one-element tuple. Is that correct?

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.

On Fri, Apr 27, 2012 at 1:42 PM, Benjamin Root
reply@reply.github.com
wrote:

         Line collection with all streamlines as a series of line segments.
         Currently, there is no way to differentiate between line segments
         on different streamlines (other than manually checking that segments

  •        are connected).
  •        are connected). NOTE: this return value is likely to change since it

Why not prepare for future changes by simply returning a one-element list?  Future revisions could then have the arrow patches as the next item in the list without breaking anyone existing code?

Because I don't think a list is the way to go for complex objects like
this. Better to return an instance of a class.

Eric


Reply to this email directly or view it on GitHub:
https://github.com/matplotlib/matplotlib/pull/849/files#r744390

@WeatherGod

Copy link
Copy Markdown
Member

Except for that one point, everything else looks good.

@tonysyu

tonysyu commented Apr 28, 2012

Copy link
Copy Markdown
Contributor Author

I just removed the note about the return value of streamplot, and I'll try to address that issue in PR #803.

@WeatherGod

Copy link
Copy Markdown
Member

I think that is much better. It is a good rule of thumb to keep PR's focused on a single issue at a time. I say this is ready to be pulled in.

WeatherGod added a commit that referenced this pull request Apr 30, 2012
Add `norm` parameter to `streamplot`.
@WeatherGod
WeatherGod merged commit 342c028 into matplotlib:master Apr 30, 2012
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.

3 participants