Question: Needour task is to create a visual report for these data. You will create a single Matplotlib Figure containing the following subplots: A scatter plot

Needour task is to create a visual report for these data. You will create a single Matplotlib Figure containing the following subplots:
A scatter plot with all_weights on the x-axis and all_mpgs on the y-axis
A line plot with unique_model_years with separate y-axes for yearly_mean_mpgs and yearly_mean_horsepower. Include markers for each data point.
Two pie charts, one each for the number of models by origin in origins_1970 and origins_1980
A series of 6 bar plots with origin_mean_mpgs, origin_mean_horsepower, origin_mean_cylinders, origin_mean_displacement, origin_mean_weight, and origin_mean_acceleration on y-axis, and each should have unique_origins on the x-axis.
The subplots should use a layout with 3 rows:
Row 1, three subplots: Scatter plot (item 1 above),2 pie charts (item 3)
Row 2,1 subplot stretched across the figure: Line plot (item 2)
Row 3,6 subplots: 6 bar plots (item 4)
Be sure to give each subplot a title and label the axes with appropriate descriptor and units. You may customize the appearance (colors, marker types, etc.) in any way you think looks appealing to be written with python code, and here is the start codeimport pandas as pd
import seaborn as sns
data = sns.load_dataset('mpg')
all_mpgs = data['mpg'].to_list()
all_weights = data['weight'].to_list()
unique_model_years = list(data['model_year'].unique())
unique_origins = sorted(list(data['origin'].unique()))
yearly_mean_mpgs = data.groupby('model_year').mean(numeric_only=True)['mpg'].to_list()
yearly_mean_horsepower = data.groupby('model_year').mean(numeric_only=True)['horsepower'].to_list()
origins_1970= data.loc[data['model_year']==70, 'origin']
origins_1980= data.loc[data['model_year']==80, 'origin']
origin_mean_mpgs = data.groupby('origin').mean(numeric_only=True)['mpg'].to_list()
origin_mean_horsepower = data.groupby('origin').mean(numeric_only=True)['horsepower'].to_list()
origin_mean_cylinders = data.groupby('origin').mean(numeric_only=True)['cylinders'].to_list()
origin_mean_displacement = data.groupby('origin').mean(numeric_only=True)['displacement'].to_list()
origin_mean_weight = data.groupby('origin').mean(numeric_only=True)['weight'].to_list()
origin_mean_acceleration = data.groupby('origin').mean(numeric_only=True)['acceleration'].to_list()

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!