-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Transform input data: groupby, filter #917
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
Comments
groupBy
, filter
As in the related PR, one additional note that, in general, scatter traces can now have |
@etpinard @rreusser Here's another example, for these things:
|
I like it. Transforms in general are kinda free-form and extremely flexible, which means it's probably good to develop a set of conventions (like |
@monfera your API looks great. I'd vote for One thing that we should attempt to handle better is the The more I think about it the more I think finding the list of all |
@etpinard @rreusser Do I understand that anything that's Assuming the answer is yes: probably I can make (or plug into) code that crawls the entire set of attributes and distinguish between splittable arrays and non-splittable arrays. But there's the issue that the attribute tree can differ by plot type, and according to other values. I'm concerned that some attribute locations in a mother of all JSON attribute dictionary will be group-splitting arrays under some circumstances and non-splitting arrays under others. |
Yes. When an
That's correct. The list of |
Previously discussed (some lists are from @chriddyp) :
A
groupby
transform should split apart traces as per unique values or bins of thegroupby
dimension. Example:should generate two traces:
Static
groupby
as a means of splitting spatially and/or aestheticallydatetime
stringsdatetime
strings) in thegroupby
attribute, reusing logic of the preexistingplotly
algorithm for histogramsFunctional aspects:
groupby
needs to work across numbers, dates, and categories (@chriddyp in the JS context, meaning strings, correct?)groupby
needs to split across all of the arrays or array-like specifications in a trace, not justx
andy
. For example,marker.color
ormarker.line.color
. Not all array-like specifications in a trace are actual arrays (considercolorscale
)There must be a way of specifying distinct styles for the split apart traces so that they're discernible - example:
@etpinard found some issues with legend items as he wrote an initial version of transforms: Introducing transform plugins #499 (comment). We'll probably need to modify some of the
transforms
and API. That's OK -transforms
was made forgroupby
All relevant denotations for
groupby
, and the related animation split use (see below) need to be in the JSON format for serializability, fitting in the current declarative structureThe transforms such as
groupby
must work in therestyle
andrelayout
steps, not just the initialplot
stepgd.data
is expected to preserve the single trace and thegroupby
spec as the user supplied, and_fullData
on the other hand has the individual (spllt) traces and no longer has thegroupby
attributeWe must ID traces in
_fullData
back to groups or styles indata
. Styling controls will be populated with the defaults from_fullData
(e.g._fullData[4].marker.color
) but they’ll need to update the attributes in thedata
object (e.g.data[0].transform.marker.color.d
). That’s because we serialize and savedata
, not_fullData
.Preliminary work
Related PR, containing the initial, analogous
filter
work by @timelyportfolio : #859groupby
: https://github.com/plotly/plotly.js/blob/master/test/jasmine/assets/transforms/groupby.jsPlanned
groupby
coverage of the initial sprintgroupby
such asx
andy
but not all at once - HOWEVER the preferred solution aims for generality because other transforms will need to use a similar approach e.g.filter
, and future arraylike attributes should be covered without code coupling to transformations (consequence: we'll have to check if there's enoughattribute
metadata that allows us to tell if it's arraylike, or we need further metadata; also, whether there's a programmatic way of separating arraylike data e.g.colorscale
that's not represented as an array at input, otherwise we need to handle them attribute by attribute (we'll have to come back to this topic after a first round of work).Initial attributes at least:
x
,y
,marker.color
,marker.size
(scatter, bar, histogram, box)Then
lat
,lon
(maps),a
,b
,c
(ternary), ‘z’ (scatter3d),error_y.array
It is expected that the trace separation (and transformations in general) is being performed in the supply defaults step.
Subsequent goal: splitting data for animations
Instead of generating
n
different paths as described above,plotly
would arrive at a temporal sequence ofn
framesPossible future items:
The text was updated successfully, but these errors were encountered: