Complete this TODO by finishing the subplot of box plots using Seaborn and Matplotlib. Use the below image to check your output as no todo_check() is given. Define a subplot using matplotlibs subplots() function. Store the output into two variables: fig and axs. Here, the axs variable will hold all our subplot grids which will determine which subplot we plot to. See docs for more help regarding subplots. Pass the following arguments that correspond to the below descriptions: The subplot should have 11 row and 1 column, meaning there will be 11 total subplots. See the arguments in the docs that refer to setting the number of rows and columns! Additionally, you will need to pass the keyword argument (kwarg) figsize (this is not listed directly in the docs). This should be equal to (20, 30) as this will ensure our plot will make all the subplots big enough to be readable. Here 20 (index 0) is the width and 30 (index 1) is the height. Feel free to increase the width/height if it is too small for you. Use Seaborn's boxplot() function to create a box plot for each of our numerical features. Call the boxplot() function using Seaborn and pass the following arguments: Pass the keyword argument x which takes the current numerical feature's data. Do so by indexing forestfire_df using the current feature numerical feature's column name stored in column_name. Pass the keyword argument (kwarg) ax which determines which subplot to plot to. Do so by passing the axs indexed by idx. idx represents the current subplot index we are currently on! See docs for box plot. import seaborn as sns import matplotlib.pyplot as plt # Gets all the numerical feature data numerical_features = forestfire_df.drop(['day', 'month'], axis=1) numerical_features # TODO 2.1 fig, axs =  # We flatten the axs variable as it would be a 2D array making it # harder to index axs = axs.flatten() # Index refers to the current index of the numerical feature columns for idx, column_name in enumerate(numerical_features.columns):     # TODO 2.2          # Sets the x-axis title for each subplot     axs[idx].set_xlabel(axs[idx].get_xlabel(), fontsize=15)      # Formats subplots so they overlap less fig.tight_layout() # Shows entire plot once done plt.show()

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

TODO 2

Complete this TODO by finishing the subplot of box plots using Seaborn and Matplotlib. Use the below image to check your output as no todo_check() is given.

  1. Define a subplot using matplotlibs subplots() function. Store the output into two variables: fig and axs. Here, the axs variable will hold all our subplot grids which will determine which subplot we plot to. See docs for more help regarding subplots. Pass the following arguments that correspond to the below descriptions:

    1. The subplot should have 11 row and 1 column, meaning there will be 11 total subplots. See the arguments in the docs that refer to setting the number of rows and columns!
    2. Additionally, you will need to pass the keyword argument (kwarg) figsize (this is not listed directly in the docs). This should be equal to (20, 30) as this will ensure our plot will make all the subplots big enough to be readable. Here 20 (index 0) is the width and 30 (index 1) is the height. Feel free to increase the width/height if it is too small for you.
  2. Use Seaborn's boxplot() function to create a box plot for each of our numerical features. Call the boxplot() function using Seaborn and pass the following arguments:

    1. Pass the keyword argument x which takes the current numerical feature's data. Do so by indexing forestfire_df using the current feature numerical feature's column name stored in column_name.
    2. Pass the keyword argument (kwarg) ax which determines which subplot to plot to. Do so by passing the axs indexed by idx. idx represents the current subplot index we are currently on! See docs for box plot.

import seaborn as sns

import matplotlib.pyplot as plt

# Gets all the numerical feature data
numerical_features = forestfire_df.drop(['day', 'month'], axis=1)
numerical_features

# TODO 2.1
fig, axs = 

# We flatten the axs variable as it would be a 2D array making it
# harder to index
axs = axs.flatten()

# Index refers to the current index of the numerical feature columns
for idx, column_name in enumerate(numerical_features.columns):
    # TODO 2.2
    
    # Sets the x-axis title for each subplot
    axs[idx].set_xlabel(axs[idx].get_xlabel(), fontsize=15)
    
# Formats subplots so they overlap less
fig.tight_layout()
# Shows entire plot once done
plt.show()

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Processes of 3D Graphics
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education