<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 Matplotlib
<img src="images/matplotlib.svg" alt="matplotlib" style="width
Step1:  Line Plots
plt.plot Plot lines and/or markers
Step2:  Scatter Plots
plt.plot can also plot markers.
Step3:  Plot properties
Add x-axis and y-axis
Step4:  Multiple plots
Step5:  Save figure
<ASSISTANT_TASK:>
Python Code:
import matplotlib.pyplot as plt
%matplotlib inline
import numpy as np
Explanation: Matplotlib
<img src="images/matplotlib.svg" alt="matplotlib" style="width: 600px;"/>
<a href="https://colab.research.google.com/github/ryan-leung/PHYS4650_Python_Tutorial/blob/master/notebooks/06-Python-Matplotlib.ipynb"><img align="right" src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open in Colab" title="Open and Execute in Google Colaboratory">
</a>
Using matplotlib in Jupyter notebook
End of explanation
x = np.arange(-np.pi,np.pi,0.01) # Create an array of x values from -pi to pi with 0.01 interval
y = np.sin(x) # Apply sin function on all x
plt.plot(x,y)
plt.plot(y)
Explanation: Line Plots
plt.plot Plot lines and/or markers:
* plot(x, y)
  * plot x and y using default line style and color
* plot(x, y, 'bo')
  * plot x and y using blue circle markers
* plot(y)
  * plot y using x as index array 0..N-1
* plot(y, 'r+')
  * Similar, but with red plusses
run 
%pdoc plt.plot 
for more details
End of explanation
x = np.arange(0,10,1)  # x = 1,2,3,4,5...
y = x*x # Squared x
plt.plot(x,y,'bo') # plot x and y using blue circle markers
plt.plot(x,y,'r+') # plot x and y using red plusses
Explanation: Scatter Plots
plt.plot can also plot markers.
End of explanation
x = np.arange(-np.pi,np.pi,0.001)
plt.plot(x,np.sin(x))
plt.title('y = sin(x)')    # title
plt.xlabel('x (radians)')  # x-axis label
plt.ylabel('y')            # y-axis label
# To plot the axis label in LaTex, we can run
from matplotlib import rc
## For sans-serif font:
rc('font',**{'family':'sans-serif','sans-serif':['Helvetica']})
rc('text', usetex=True)
## for Palatino and other serif fonts use:
#rc('font',**{'family':'serif','serif':['Palatino']})
plt.plot(x,np.sin(x))
plt.title(r'T = sin($\theta$)')    # title, the `r` in front of the string means raw string
plt.xlabel(r'$\theta$ (radians)')  # x-axis label, LaTex synatx should be encoded with $$
plt.ylabel('T')            # y-axis label
Explanation: Plot properties
Add x-axis and y-axis
End of explanation
x1 = np.linspace(0.0, 5.0)
x2 = np.linspace(0.0, 2.0)
y1 = np.cos(2 * np.pi * x1) * np.exp(-x1)
y2 = np.cos(2 * np.pi * x2)
plt.subplot(2, 1, 1)
plt.plot(x1, y1, '.-')
plt.title('Plot 2 graph at the same time')
plt.ylabel('Amplitude (Damped)')
plt.subplot(2, 1, 2)
plt.plot(x2, y2, '.-')
plt.xlabel('time (s)')
plt.ylabel('Amplitude (Undamped)')
Explanation: Multiple plots
End of explanation
plt.plot(x,np.sin(x))
plt.savefig('plot.pdf')
plt.savefig('plot.png')
# To load image into this Jupyter notebook
from IPython.display import Image
Image("plot.png")
Explanation: Save figure
End of explanation
<END_TASK>