-
Notifications
You must be signed in to change notification settings - Fork 187
select{First,Last}[XY] #989
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❤️
so window leaves undefined points rather than changing the length of the data array? e.g. as you change the k of a Plot.windowY, the extent of the x-axis won't change, it'll just get empty bits at the ends. those points have x values but not y values, right?
when i was struggling earlier, i think i actually tried Plot.selectLastX to see if it'd work. but it'd actually be Plot.selectLastY in my case, right? i think i guessed X because it's the last along the x-axis — but no, it's last in input order, it's selectLastY because Y is what has to be defined.
to position a text label in x and y at the end of the line, i really need the last point where both x and y are defined, right? but one should always imply the other, unless you have weird gappy stuff.
i'm trying to think of when i wouldn't want regular selectLast to have this behavior. maybe something like: i have multi-line chart of stock prices, and wanna put a dot for the current price, but if a stock was delisted a year ago i don't want a dot at the end of that line because that wouldn't be current; its current price is truly undefined.
…at are not filtered alternative to #989
Very much needed. But let me suggest a more generic alternative in #991. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm still not sold on this idea.
It feels like the beginning of an intractable DSL (selectMaxXYRFillOpacity?).
With #993 (and #996 (?)) the original motivation ⌾ for this change has been solved.
Also, I forgot to mention this alternative:
Plot.selectMaxX({ x: "date", y: "unemployment", filter: "unemployment" })
Agreed. This feels too limited and overfit to the particular use case, and it is less likely to be a problem with the non-strict window transform. Though, this PR is slightly more flexible than implied by selectLastX because you can also say I couldn’t figure out how the get the selectMaxX alternative to work, at least not without #993. Or were you just saying that’s equivalent to selectLast? In the case of a window transform, the effective y channel can’t be referred to by name (e.g., “unemployment” or “value”) because it is constructed by the transform. Another thought here is we could have an offset option to selectFirst and selectLast that lets you chose an item near the start or end. |
You're right, the alternative only works on the original data, not in the OP. |
Fixes #988.