Reputation: 2189
I have been searching for a couple of hours, but cannot find any example of scatterplot matrix using the Plotly Dash framework in python. (Using Dash and not Plotly create_scatterplotmatrix)
Can someone give me a simple example of a scatterplot matrix using Dash framework?
Upvotes: 2
Views: 3673
Reputation: 2308
Dash uses Plot.ly to make its charts, so the Plot.ly documentation for charts is the same as Plot.ly's documentation. The only separate documentation is about how to make webpages and use HTML components and callbacks. You can look at Plotly's scatter plot documentation Scatter Plots 2D Scatter Plots 3D to see how they are made. You can use the Plotly Express
package which is part of dash to easily put your scatter plot into a Dash App:
import dash
import dash_core_components as dcc
import dash_html_components as html
import plotly.express as px
import pandas as pd
external_stylesheets = ['https://codepen.io/chriddyp/pen/bWLwgP.css']
app = dash.Dash(__name__, external_stylesheets=external_stylesheets)
df = pd.read_csv('https://gist.githubusercontent.com/chriddyp/5d1ea79569ed194d432e56108a04d188/raw/a9f9e8076b837d541398e999dcbac2b2826a81f8/gdp-life-exp-2007.csv')
fig = px.scatter(df, x="gdp per capita", y="life expectancy",
size="population", color="continent", hover_name="country",
log_x=True, size_max=60)
app.layout = html.Div([
dcc.Graph(
id='life-exp-vs-gdp',
figure=fig
)
])
if __name__ == '__main__':
app.run_server(debug=False)
As seen above you an just call px.scatter(...)
and produce a scatter plot. This example was taken from the Dash introduction documentation here. To see the output of a more advanced Dash scatter plot see the example from @PirateX.
Upvotes: 1