Multiple category scatter plot in dash plotly

Viewed 691

I am new to Dash and dashboard development generally and I ran into the following issue. So, here are the contents of an example DataFrame that I am working with:

data = {
    'color': ['blue', 'blue', 'yellow', 'red', 'red', 'orange'],
    'value1': [30, 35, 11, 57, 47, 93],
    'value2': [1, 4, 6, 3, 3, 7]
}

What I'd like to achieve, is to create one scatter plot that will show all of those items (i.e. color in this example) in a single plot. Looking at the open source Dash examples, this is achieved manually by calling go.Scatter multiple times, see code example here.

How can I achieve this programmatically and not having to call go.Scatter a gazillion times? The content of my DataFrame is dynamic, so I cannot even have static code.

The exact same question has been asked elsewhere (Multiple Line Charts) but the answer suggests using plotly.express which is not the solution I am looking for.

0 Answers
Related