Conversation
|
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? |
|
How about kwarg "step" for "mid, pre, post", and "skip" as described above? |
|
import matplotlib.pyplot as plt
import numpy as np
x = y = np.arange(5)
fig, ax_list = plt. subplots(3, 1)
for ax, where in zip(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])I suspect that ma works (I was thinking about that when I wrote it), but have not tested. |
|
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 people want 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"? |
|
I am sold on changing I think the use-case for fill_between is skewed towards large numbers of On Tue, May 19, 2015 at 1:08 PM Eric Firing [email protected]
|
|
This just needs a whats new entry before this gets merged, right? |
|
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. |
be49092 to
0562b46
Compare
Changes to docstring to attempt to conform to numpydoc format.
Added 3 public functions for converting points -> steps for the 3 step locations + 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 to awkwardly large number of .T to make this work here.
Add dict to cbook to map strings -> functions
Add ability to fill between 'step' plots. Closes matplotlib#643 and matplotlib#1709
0562b46 to
e89238b
Compare
|
rebased to deal with conflicts in |
examples/api/filled_step.py
Outdated
There was a problem hiding this comment.
"bin" -> "bin counts or values" (?)
|
Apart from the docstring tweaks, I think this is ready to go, right? |
|
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) |
|
closes #643 |
|
The test failure is from the doc build timing out which has been fixed on master, can this be merged? |

Generates:
The interaction with
whereis a bit strange, but I think it is defendable as correct.This stils needs tests + docs for the new feature.