Lab Topic 12 individual

.docx

School

Texas A&M University *

*We aren’t endorsed by this school

Course

102

Subject

Computer Science

Date

Jan 9, 2024

Type

docx

Pages

2

Uploaded by ProfLightning103643 on coursehero.com

Lab: Topic 12 (individual) ENGR 102 Lab: Topic 12 (individual) Deliverables : There are two deliverables for this assignment. Please submit the following files to zyBooks: pretty_plot.py plotting_data.py This week’s team and individual assignments are meant to familiarize you with two of the most commonly used engineering packages in Python: numpy and matplotlib . This individual assignment is meant to follow on to the team lab work. It is best to complete the team lab first. Activity #1 : Pretty plot – individual Create a program named pretty_plot.py that repeatedly multiplies a matrix by a point and plots the results. Start with a 2D point, ( x, y ) . This point can be represented as a vector: v = [ x y ] . There is also defined a 2x2 matrix, M = [ abc d ] . Computing the product of M with v will give a new point v ' : v ' = Mv . Then, multiply the matrix M by the new point v ' , to get another point, i.e. v ' ' = M v ' . This can go on indefinitely, creating a long sequence of points. Your program should use numpy to create a matrix and a point. Begin with the point ( 0,1 ) and the matrix: [ 1.010.09 0.091.01 ] . Then, multiply the matrix by the point to get a new point. Repeat for a total of 200 times. Have your program plot the data points using matplotlib . Be sure to label the x and y axes, and include a title. Your title should give a brief description of the shape that the points “trace” out. Note : the purpose of this activity is to get practice with numpy , so you should use numpy for your operations, even if you find it easier to perform this computation a different way. Activity #2 : Plotting data – individual This program will be a follow-on to the program from last week’s individual assignment, Activity #3. In that assignment, you read in weather data from the file WeatherDataCLL.csv . Write a program named plotting_data.py to (again) read in weather data from the same file and plot the data in a set of graphs described below. You may re-use code from the previous assignment for reading in data from a file. Using matplotlib , create the following 4 graphs. 1) Create a line graph that shows both the maximum temperature and average wind speed plotted over the period of time. Both lines should be plotted on the same graph, with date on the x-axis, and different y axes for the two different measurements. (Please do not spend time dealing with “date data type.” Please just consider the dates in the data to be strings, or, you may simply consider the days as integers for plotting.) 2) Create a histogram of the average wind speed. The x axis should cover a reasonable range of average wind speeds, and the y axis should show the number of days that had an average wind speed in the specific range. 3) Create a scatterplot indicating the relationship (or lack thereof) between average wind speed and minimum temperature (one on each axis). Based upon Dr. Keyser’s Original1Revised Summer 2023 JL
Lab: Topic 12 (individual) 4) Create a bar chart , with one bar per calendar month (each month from all 3 years), showing the average temperature, along with lines indicating the highest high and lowest low temperatures from that month. a. Note: You may want to create new lists of data, but you may find it useful to use the max/min/sum functions on lists. b. This is a great problem to practice using dictionaries! See the example plots below. Your plots do NOT have to look exactly the same, but they must include a title, axis labels, and a legend (where appropriate). You should also learn how to control the width, color, and shape of your lines and plotted points, as well as ensure your scales/ranges are set appropriately to display all of the data nicely, however these are highly subjective and you will not be graded on them. Include all four (4) plots in your program. Based upon Dr. Keyser’s Original2Revised Summer 2023 JL Plot 1 Plot 2 Plot 3 Plot 4
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help