-
-
Notifications
You must be signed in to change notification settings - Fork 368
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Filled area support #734
Filled area support #734
Conversation
Adds function to render trapezoids with parallel edges that are aligned with the y-axis. These are the primitives that will be used to create area glyphs.
This function relies on the new AreaToZero and AreaToLine glyphs. AreaToZero handles area plots between a line and y=0. AreaToLine handles area plots between two lines that share the same x-axis coordinates.
Seems some tornado version incompatibility may have cropped up in the tests. looks like nbsmoke/nbconvert is raising an error:
|
@jonmmease I restarted the failing build and it seems to be passing now. Maybe some other dependency ended up pinning tornado for us? At any rate, I'll now have a look at this PR... |
Just a quick note to say I've tried the PR and it seems to be working as expected! I've tested whether this could be used to draw axis-aligned filled boxes for a project I am working on and it behaves the way I would expect. |
One issue I have spotted - replacing I suppose the |
@jonmmease , it would be great to have the axis support as well, to make it simple to switch from line to area and back as needed. One possible feature request: If we're showing the area between two curves a and b, would it be possible to somehow indicate the regions where a was higher than b differently from the regions where b is higher than a? E.g. the first case could aggregate positively, and the second negatively? I'm trying to think about the cases where people use area shading between curves in general, where usually it's to highlight differences between the curves, and it seems like the sign of that difference is crucially important in that case. |
Thanks for the feedback and trying this out @jlstevens Yes, that's right that the Happy to talk more about it if someone has ideas for how the Regarding aggregation, perhaps we could define a new |
I would expect the axis argument support to work just as for cvs.line, i.e. only really being relevant for the case of filling from the x axis to the line. I don't think there's a meaningful extension of the between-the-lines filling for that case, and doing every other line sounds quite arbitrary, so I'd be very happy if it simply did all that cvs.line does, plus separate support for filling between two lines (the only bit of the API or behavior that wouldn't match cvs.line, and strictly being an extension/superset rather than a difference.) The goal is that any user of cvs.line should be able to switch to cvs.area to try it out without encountering any issues, and I think that's achievable here. The proposed aggregator sounds great! |
Sounds good! I'll see what makes sense in terms of the fill-between-lines API as a get a bit further in refactoring this. |
Looks promising; tag me and @jlstevens when it's ready for re-review! |
Will do! Should be soon now 🙂 |
@jbednar @jlstevens Alright, this is ready for another look! Main PR description above has been updated with the new API. |
Looks great! I really appreciate your careful docstrings, comments, and test cases, and I was able to use it anywhere I expected cvs.line to work, without any problems. The underlying numerical code makes my brain go numb, so I can't comment on that, but it certainly seems to behave properly. Does the Also, were you able to look into an implementation of Unless @jlstevens can spot any problems, I'm happy to merge this! |
Thanks for taking a look @jbednar,
Yes,
No, not yet. But I take a look soon. |
Sounds great! |
Looks good to me! My only observation here is that |
Overview
This PR add a new
Canvas.area
function to support the creation of filled area plots with Datashader.Examples
Imports and dataset
Plot 'A1' vs 'B1' and 'B2' as lines
Plot filled area from 'B1' to y=0.
Plot filled area from 'B1' to 'B2' using the
y_stack
argument toCanvas.area
.Mutli-line with axis=0
Multi-area with axis=0
Mutli-line with axis=0 and shared x
Multi-area with axis=0 and shared x
Multi-line with axis=1
Multi-area with axis=1
Ragged array lines
Ragged areas filled to zero line
Ragged areas filled to ragged line
Ragged areas filled to ragged with
count_cat
aggregatorDocumentation
I added a new area plot section to the Timeseries user guide. See the user guide for full code:
Performance
I haven't done extensive benchmarking, but in all of the cases I've tried the render time has been within a factor of two of the time to render the line by itself.