Dave Hirschfeld
Dave Hirschfeld

Reputation: 768

The R equivalent of the Python plotly.tools.FigureFactory.create_scatterplotmatrix?

I'm trying to recreate in R the scatterplotmatrix from the Python plotly tutorial:

http://moderndata.plot.ly/using-plotly-in-jupyter-notebooks-on-microsoft-azure/

I have the dataframe in R, but what is the equivalent plotly code in R to recreate the below Python call?

fig = FigureFactory.create_scatterplotmatrix(
    df, diag='histogram', index='manufacturer',
    height=800, width=800,
    title='Motor Trend Car Road Tests Scatterplot Matrix'
)

Upvotes: 1

Views: 347

Answers (1)

Carson
Carson

Reputation: 2767

The ggairs() function in the GGally package makes it easy to create generalized pairs plots (e.g. scatterplot matrix) via ggplot2, and ggplotly() knows how to translate them to plotly.

library(GGally)
library(plotly)
ggplotly(ggpairs(iris))

Upvotes: 2

Related Questions