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

ENH : stepfill between#4433

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
efiring merged 9 commits intomatplotlib:masterfromtacaswell:enh_stepfill_between
Jul 22, 2015

Conversation

tacaswell
Copy link
Member

importmatplotlib.pyplotaspltimportnumpyasnpx=y=np.arange(5)fig,ax_list=plt.subplots(3,1)forax,whereinzip(ax_list, ['pre','post','mid']):ax.step(x,y,where=where,color='r',zorder=5,lw=5)ax.step(x,-y,where=where,color='k',zorder=5,lw=5)ax.fill_between(x,y,-y,step_where=where,where=[1,1 ,0,1,1])fig,ax_list=plt.subplots(3,1)forax,whereinzip(ax_list, ['pre','post','mid']):ax.step(x,y,where=where,color='r',zorder=5,lw=5)ax.step(x,-y,where=where,color='k',zorder=5,lw=5)ax.fill_between(x,y,-y,step_where=where)fig,ax_list=plt.subplots(3,1)forax,whereinzip(ax_list, ['pre','post','mid']):ax.step(x,y,where=where,color='r',zorder=5,lw=5)ax.fill_between(x,y,0,step_where=where)

Generates:

so2

so3

so1

The interaction withwhere is a bit strange, but I think it is defendable as correct.

This stils needs tests + docs for the new feature.

@tacaswelltacaswell added this to thenext point release milestoneMay 15, 2015
@tacaswelltacaswell changed the titleEnh stepfill betweenENH : stepfill betweenMay 15, 2015
@tacaswell
Copy link
MemberAuthor

@efiring@mdboom Comments on this? I would like to get feed back on the handling of mid + where before I write tests (which will probably just be the above examples).

@efiring
Copy link
Member

Yes, the "where" kwarg is confusing and surprising. First, I would expect "where" to be used in a way that matches its use in step. Second, your example of a "where" kwarg has the surprising result that a single zero knocks out two blocks of fill; presumably this means there is no way to knock out a single block. Maybe "where" could replace "step_where", and then a "skip" could replace "where"; "skip" would be like a mask (True is masked, so skip the point). Then the "mid" case is easy--there is one color block per point. For "pre" and "post" probably the simplest thing would be to require and use only n-1 values, corresponding to the filled blocks.

Are masked arrays also supported?

@efiring
Copy link
Member

How about kwarg "step" for "mid, pre, post", and "skip" as described above?

@tacaswell
Copy link
MemberAuthor

where has been in the API as long as I remember and knocking out two squares is consistent with the currentfill_between behaviour.

importmatplotlib.pyplotaspltimportnumpyasnpx=y=np.arange(5)fig,ax_list=plt.subplots(3,1)forax,whereinzip(ax_list, ['pre','post','mid']):ax.step(x,y,where=where,color='r',zorder=5,lw=5)ax.step(x,-y,where=where,color='k',zorder=5,lw=5)ax.fill_between(x,y,-y,where=[1,1 ,0,1,1])

so

I suspect that ma works (I was thinking about that when I wrote it), but have not tested.

@efiring
Copy link
Member

OK, we are stuck with "where", which is like the inverse of the mask if the y values were a masked array. Nevertheless, I'm not sure that keeping full consistency with the non-step behavior is a good idea. What will people actually want to do? Will peoplewant to be able to knock out a single block? I've never used "where", so I don't have use cases in mind. I'm not necessarily opposed to your consistency argument--just trying to anticipate complaints.

As for "step_where": having the "where" in that kwarg name makes it unnecessarily confusing, given that there is a plain "where" kwarg as well. Is there any reason not to just call it "step", or use "linestyle" or "style"?

@tacaswell
Copy link
MemberAuthor

I am sold on changingstep_where ->step. I will try to get to that
tonight.

I think the use-case for fill_between is skewed towards large numbers of
points exax.fill_between(x, y1, y2, where=y2 > .5) with len(x) >>100 in
which case taking out two bins is not a huge deal.

On Tue, May 19, 2015 at 1:08 PM Eric Firingnotifications@github.com
wrote:

OK, we are stuck with "where", which is like the inverse of the mask if
the y values were a masked array. Nevertheless, I'm not sure that keeping
full consistency with the non-step behavior is a good idea. What will
people actually want to do? Will peoplewant to be able to knock out a
single block? I've never used "where", so I don't have use cases in mind.
I'm not necessarily opposed to your consistency argument--just trying to
anticipate complaints.

As for "step_where": having the "where" in that kwarg name makes it
unnecessarily confusing, given that there is a plain "where" kwarg as well.
Is there any reason not to just call it "step", or use "linestyle" or
"style"?


Reply to this email directly or view it on GitHub
#4433 (comment)
.

@WeatherGod
Copy link
Member

This just needs a whats new entry before this gets merged, right?

@tacaswell
Copy link
MemberAuthor

Added what's new and example.

This also has some of my ideas on how to deal with labeled data and how to start fixing hist in general.

Changes to docstring to attempt to conform to numpydocformat.
Added 3 public functions for converting points -> steps for the 3 steplocations + 1 private function for input validation
Use the centralized version of the points -> step conversion.Slightly questioning my API choices on the cbook functions due toawkwardly large number of .T to make this work here.
Add dict to cbook to map strings -> functions
Add ability to fill between 'step' plots.Closesmatplotlib#643 andmatplotlib#1709
@tacaswell
Copy link
MemberAuthor

rebased to deal with conflicts in.travis.yaml

@@ -0,0 +1,12 @@
Add step kwmargs to fill_between
Copy link
Member

Choose a reason for hiding this comment

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

sp: kwargs

right edge of the last bin.

values : array
A length n array of bin
Copy link
Member

Choose a reason for hiding this comment

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

"bin" -> "bin counts or values" (?)

@efiring
Copy link
Member

Apart from the docstring tweaks, I think this is ready to go, right?

@tacaswell
Copy link
MemberAuthor

Yes, I'll take care of that now (I wrote some fo those examples at stupid oclock in the morning due to my sleep schedule being very messed up after scipy, I am surprised any of it is in English)

@tacaswell
Copy link
MemberAuthor

closes#643

@tacaswell
Copy link
MemberAuthor

The test failure is from the doc build timing out which has been fixed on master, can this be merged?

efiring added a commit that referenced this pull requestJul 22, 2015
@efiringefiring merged commita892633 intomatplotlib:masterJul 22, 2015
@tacaswelltacaswell deleted the enh_stepfill_between branchJuly 22, 2015 03:14
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
v1.5.0
Development

Successfully merging this pull request may close these issues.

3 participants
@tacaswell@efiring@WeatherGod

[8]ページ先頭

©2009-2025 Movatter.jp