plotly / plotly.js

Open-source JavaScript charting library behind Plotly and Dash

Home Page:https://plotly.com/javascript/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Histograms on splom diagonals

alexcjohnson opened this issue · comments

Several other implementations of splom allow for a different plot type on the diagonal - which makes sense because the diagonal subplots are always just diagonal lines of points. What we really want is a simple view of the distribution of that one dimension in each diagonal subplot. For my current purposes the best view would be a histogram, and I suspect implementing only that would be a well-received improvement, but eventually box and violin could also be nice additions.

We anticipated this feature with a comment in #2555 and with a comment in the attributes for splom:

diagonal: {
visible: {
valType: 'boolean',
dflt: true,
editType: 'calc',
description: [
'Determines whether or not subplots on the diagonal are displayed.'
].join(' ')
},
// type: 'scattergl' | 'histogram' | 'box' | 'violin'
// ...
// more options
editType: 'calc'
},

That comment I think is right, trace.diagonal.type sets the trace type for all of the diagonal subplots, then we add more attributes into trace.diagonal that mirror the attributes available to histogram (and the other trace types if we add those). For histograms, trace.diagonal.marker.color should be inherited from trace.marker.color (and maybe similar with marker.line.width and marker.line.width?)

In addition, each dimension should be able to override everything about its own diagonal subplot, so trace.dimensions[i].diagonal should accept all the same options as trace.diagonal.

I think instead of type we may need a container e.g. trace to help specify extra trace options e.g. zsmooth for heatmap. Right?

Is diagonal not already enough of a container? Everything in there, including type, is trace attributes for what you show on the diagonal, with the caveat that the one existing attribute there, visible, also controls whether we even create that subplot, but that seems OK to me.

Yes that's enough. There is not much in it at the moment.

@alexcjohnson FYI - I did spend some time on this on the way to MTL on splom-diagonal-histogram branch.
But it turned out to be a complex project considering the need to provide various steps e.g. supply-defaults, calc and cross-trace-calc for heatmap to be drawn.