Now we can do the data visualization interfaces by using python by the dash framework. There is no need for multiple programming languages and frameworks to analyze and visualize the data.
About Dash
Dash framework in python is for creating interactive analytical web applications. It uses Flask for the backend and React.js components for the frontend.
Dash was developed by plotly in 2017.Plotly is a company based on technical computing that provides online graphing, analytics, and statistics tools.
Start with Dash
To start your app, we need a new directory to save code and a new virtual environment to manage Python packages.
Create a requirement.txt file with the following
dash==2.6.1
jupyter-dash==0.4.2
pandas==1.4.3
Install the libraries by $pip install -r requirement.txt
Dash Layouts
It defines the looks of the application like size, color, placements, and graphs. create a file named app.py and add the code below.
Visit http://127.0.0.1:8050/ in your web browser. You should see an app that looks like the one above.html.H1(children=Test Dash’) component generates a <h1>Test Dash</h1> HTML element in your application.We can modify the styles of the component.
Above code generates <h1 style=”text-align: center; color: black”>Tesh Dash</h1>
Dash Callbacks
In layouts you have seen the app description and components. Here you are going to see about the callback- the interactivity of the Dash app.
Above used pandas to load the dataframe.In the callback, there are two arguments output and input. Both take two arguments component_id and component_property where component_id is the id of the components and component_property is the property like figure, value, and options. the input was the “value” property of dcc.slider and the output was the “figure” property of dcc.Graph
The above image shows the changing of year slider updating the chart.