Exercise: Continuous vs. Categorical Bivariate Analysis
Explore continuous and categorical bivariate analysis techniques using Plotly. Learn to create bar charts, box plots with multiple traces, and ECDF curves to visualize relationships in your data effectively.
We'll cover the following...
Exercise 1
Create a bar chart in Plotly graph objects that detail the revenue per math (in thousands of Euros) for each of the top 10 leagues. We’ll use the sport_organisation_figures.csv dataset.
Solution
-
The below code snippet creates a bar chart using the
go.Bar()function on line 2 from theplotly.graph_objsmodule. -
The x-axis represents the
Leaguecolumn of thetop_leaguesDataFrame, and the y-axis represents theRevenue per match (in thousands of euros)column. -
A new figure object is created using the
go.Figure()function on line 6 with the trace as its data. Finally, theshow()function is called to display the generated bar chart.
Exercise 2
Using Plotly graph ...