plotly_express
plotly_express copied to clipboard
SPLOM diagonals
from https://community.plot.ly/t/plotly-express-scatterplot-matrix-diagonal/21464
Is it somehow possible to set the diagonal of the scatterplot matrix in plotly express to a histogram like in pandas? And even more better like seaborns pairgrid a stack histogram with its argument hue? Would be really nice.
Would love this to be built in at the plotly.js level. From https://github.com/plotly/plotly.js/issues/2555:
Things we could do, but would require some thought
- Add sub-trace on the diagonal (e.g. with
diagonal.mode: 'scattergl' || 'histogram' || 'box' || 'violin'
, see #2505 (comment)
Yeah we definitely need this baked in at the JS level! I'd want brushing to match, meaning if I lasso-select some points, I'd see "part of" the diagonal being selected somehow. Easy with histograms (just shade part of the bar) but harded with box/violin.
I'd also love to be able to have contours in the upper triangle and points in the lower triangle, or something like that. Brushing in that case seems very challenging though:
Ah yeah, contours on one triangle would be cool! One easy way to handle brushing in that case would be to just use the coordinates of the outline to select the corresponding points as though the display was scatter. On the diagonal I guess brushing should be limited to 1D regardless of the display mode.
Oh no I mean the other way: if you select some blob-shaped assortment of points in a scatter subplot, how do you render the contours/histogram/boxes?
Ah I see. For all the diagonal options I feel like we can make a separate "filtered" trace - so a second histogram inside the first, a separate violin/box next to the first.
Definitely tricky for contours though... it's hard to make two overlaid contour plots useful. So either we just plot contours of the selected data, or perhaps faded black & white contours of the full data set with semi-transparent contours in color on top of it, kind of like parcoords
Something like that, yep
This would be really neat, is anything like this planned?
Is this not possible with graph_objects.Splom
?
@grisaitis not yet! Plotly Express uses graph_objects.Splom
under the hood so if it were possible there we'd have it in PX as well already :)
Ok so the roadblock is that the main dependency doesn't support this. Do we know of an open issue in plotly/plotly about this?
Yep: https://github.com/plotly/plotly.js/issues/2555
Any news on this? Coming from a data science background, this seems like a very common plot that would be super useful for EDA!
Bump for histograms on the diagonals
👍 Would love to see this too!
@nicolaskruchten - I really like your suggestion. Would be very nice to have this as a feature.
Hi all,
This would be wunderful to have in Plotly express. Charts like this are really workhorse when presenting classification algorithms.
Seaborn has similar algo implemented https://seaborn.pydata.org/examples/scatterplot_matrix.html . It is kind of shame for Plotly not to have sth like that already implemented.
I saw similar implementation in figure factory, but ff seems not to be maintained anymore, correct me if I am wrong?
Is there any update on this?
While not using px it is possible with the figure factory, as a workaround until this is added to px:
ff.create_scatterplotmatrix
using the diag='histogram'
option.