Plotting Data in Python using Matplotlib
CSV files can be read using pandas read_csv method. Using this method you can easily use the dataframes created to plot the data. For today’s exercise we will be using the recorded flight time for the x-axis of our line charts. Students will record flight data from their drones and plot the data against time using Python.
National Standards Alignment
OVERVIEW
Activity Overview:
CSV files can be read using pandas read_csv method. Using this method you can easily use the dataframes created to plot the data. For today’s exercise we will be using the recorded flight time for the x-axis of our line charts. Students will record flight data from their drones and plot the data against time using Python.
Meta description
- Subject Area: Computer Science, Mathematics, Technology, Engineering
- Grade Level : 9-12
- Computer Science Domains:
- Data Analysis
- Computer Science Principles:
- Developing and Using Abstractions
- Creating Computational Artifacts
- Testing and Refining Computational Artifacts
- Communicating About Computing
- Materials:
- Website, Computers with Python, Matplotlib, CSV, and Pandas
- Considerations:
- Prior knowledge on using Codrone Lite drones and the Codrone Library. Teachers should also have a working knowledge of Python, Pandas, and Matplotlib.
Lesson Plan
Overview
CSV files can be read using pandas read_csv method. Using this method you can easily use the dataframes created to plot the data. For today’s exercise we will be using the recorded flight time for the x-axis of our line charts. Students will record flight data from their drones and plot the data against time using Python.
ASSESSMENT PRE/POST-TEST
What type of chart/graph would you use to show a data series over time? How does Python use pandas to show a data series? What library/module will you import into your python program to chart data?
OBJECTIVES
- Read a csv file with Python. 2: Use the Pandas library to read the data into a dataframe. 3: Plot data from the dataframes using Matplotlib.
CATCH/HOOK
Prove how high you can fly with MVHS technology using our amazing fleet of drones! Students will test the limits of their drones and compare the resulting data.
ACTIVITY INSTRUCTIONS
- Have your drone complete a mission
- Collect the data from the drone
- Create a program in Python called DronePlot.py. Make sure to put your name in the title of the chart.
- Create a plot of your battery voltage over time.
- Save the image as a pdf file called battery.pdf
- Create a plot of your flight height over time.
- Save the image as a pdf file called height.pdf
- Create a plot of your flight Air Pressure over time.
- Save the image as pdf file called pressure.pdf
- Submit all three charts and your code to this assignment.
- Good Luck Pilots!
Supplements
Any items in this section are the property & under the license of their respective owners.
REVIEW
Check for understanding: (3-2-1 Google Form)
- Record 3 things you learned during this lesson.
- Record two things you found interesting and would like to know more about.
- Record 1 question you still have about the material.
STANDARDS
| Type | Listing |
|---|---|
| CS Domains | Data Analysis |
| CS Principles | Developing and Using Abstractions, Creating Computational Artifacts, Testing and Refining Computational Artifacts, Communicating About Computing |
| Other Content Standards | ISTE standards for students 1.5.a, 1.5.b, 1.6.a, 1.6c |