You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Static groupby as a means of splitting spatially and/or aesthetically
distinct categorical values: numbers, strings or datetime strings
evenly spaced bins based on numerical data or time (datetime strings) in the groupby attribute, reusing logic of the preexisting plotly algorithm for histograms
Functional 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 just x and y. For example, marker.color or marker.line.color. Not all array-like specifications in a trace are actual arrays (consider colorscale)
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 for groupby
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 structure
The transforms such as groupby must work in the restyle and relayout steps, not just the initial plot step
gd.data is expected to preserve the single trace and the groupby spec as the user supplied, and _fullData on the other hand has the individual (spllt) traces and no longer has the groupby attribute
We must ID traces in _fullData back to groups or styles in data. 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 the data object (e.g. data[0].transform.marker.color.d). That’s because we serialize and save data, not _fullData.
It would cover a positive list of attributes for groupby such as x and y 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 enough attribute 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 would cover a set of (initially, non-WebGL) traces
First goalpost is separation by category (JS number or string)
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 of n frames
Possible future items:
Incremental recalculation (e.g. of bins, upon newly arriving data points)
Combine this with a subplots transform for rendering the traces into separate subplots (as small multiples plots)
Previously discussed (some lists are from @chriddyp) :
A
groupbytransform should split apart traces as per unique values or bins of thegroupbydimension. Example:should generate two traces:
Static
groupbyas a means of splitting spatially and/or aestheticallydatetimestringsdatetimestrings) in thegroupbyattribute, reusing logic of the preexistingplotlyalgorithm for histogramsFunctional aspects:
groupbyneeds to work across numbers, dates, and categories (@chriddyp in the JS context, meaning strings, correct?)groupbyneeds to split across all of the arrays or array-like specifications in a trace, not justxandy. For example,marker.colorormarker.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
transformsand API. That's OK -transformswas made forgroupbyAll 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
groupbymust work in therestyleandrelayoutsteps, not just the initialplotstepgd.datais expected to preserve the single trace and thegroupbyspec as the user supplied, and_fullDataon the other hand has the individual (spllt) traces and no longer has thegroupbyattributeWe must ID traces in
_fullDataback 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 thedataobject (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
filterwork by @timelyportfolio : #859groupby: https://github.com/plotly/plotly.js/blob/master/test/jasmine/assets/transforms/groupby.jsPlanned
groupbycoverage of the initial sprintgroupbysuch asxandybut 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 enoughattributemetadata 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.colorscalethat'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.arrayIt 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
ndifferent paths as described above,plotlywould arrive at a temporal sequence ofnframesPossible future items: