2

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?

3
  • 1
    Scatterplot example is there on there website Commented May 25, 2020 at 22:07
  • 1
    Do you mind to provide a mcve? It will be great a sample of your df and an idea of the output you are looking for. Commented May 25, 2020 at 23:41
  • @PirateX I am looking for scatterplot matrix and not scatterplot. And of course sample, not visualization Commented May 26, 2020 at 5:31

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.