Scatter chart with drop down list and radio items in plotly dash

Scatter chart with drop down list and radio buttons in plotly dash

Create scatter chart with drop down list and radio items in plotly dash using an interactive plotly data visualizations library and dash library.

Inputs: Drop down list and radio items

This scatter chart with drop down list and radio items in plotly dash has two input components that are drop down list and radio items. Radio items depend on the drop down list. When any value is selected in the drop down list, as a result, radio items get update in the dash app according to the value of drop down list. Scatter chart update data when any value changes in the drop down list or radio items. It depends on these two inputs component.

See below how this dashboard work?

Layout of radio items

When you create layout of radio items inside the dash app layout, don’t import items in the options parameter. Leave this parameter blank list and values will update in this parameter from the chained callback. You can see below in the code template line 6.

Chained callbacks

Create chained callbacks to import dependent radio items values from the drop down list. You can see below in the code template from lines 1 to 6. You can see there, I have used input values from the drop down list and output values are for options in the callback. In the second callback, I have selected default value in the radio items component. View line 12 in the code template below.

Scatter chart

To create scatter chart, line 6 is important in the below code template. Create new data frame for filtering data and put id of both input components equal to corresponding columns. Select mode is equal to only markers in the line 14 for creating scatter chart.

Download the full code and CSV data file and learn more about plotly dash on Udemy.


If you have any problem in learning above code, please comment in the comment box. I will help you as soon as possible.


Recommended For You

About the Author: Mubeen Ali

I am passionate about learning Dash. Dash is a python framework that creates beautiful web based data visualization dashboards.