Today we are going to
1. learn more about lists and then plot them (pdf=Lists Combined with Plotting)
Here is a reading on lists. http://www.tutorialspoint.com/python/python_lists.htm
VIDEO
QUIZ After Video-Take the quiz on courseworks.
HOMEWORK
Homework 2 Due beginning of next class (Monday January 29, 2024).
- Code.org intro course through stage 15
- Make plots Like below.
- Hand in your notebook. It ends in .ipynb. this lets me run your notebook if there are any issues.
Make 2 lists
x=np.array([1,2,3,4,5,6])
y=np.array([6,5,4,3,2,1])
plot x versus y.
You will need to add this to the top of your code
%matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
The matplotlib inline tells the ipython notebook to show the graphs. The import import matplotlib.pyplot as plt tells python to import the plotting package so we can use the plotting functions and make great plots.
Make an x,y plot using ax.plot.
Using the links in today’s notebook for ideas.
- choose your favorite shape
- choose your favorite color
- choose your favorite linestyle.
- choose something else to change (e.g. linewidth…)
here is my example-
What are the axes missing?
Add axis labels and a title?
Make sure to use Markdown to put your name and section at the beginning of the HW file and a description of the assignment
Use Markdown to add a figure caption. This one can be brief but get in the habit.
This is my example but it is not perfect!!!!! something similar without the missing parts will get you a 50.
x=np.array([1,2,3,4,5,6])
y=np.array([6,5,4,3,2,1])
fig,ax=plt.subplots()
ax.plot(x,y,marker=’^’,color=’r’,markersize=10,markeredgecolor=’g’,markeredgewidth=10,linestyle=’–‘)