Last modified: Oct, 2015
A typical plotting script using Matplotlib
This script tries to do the similar task with the example script in Matlab.
Plot multiple y axes/scales in a single plot
See the official example here, using ax.twinx(). My example:
- Alternative to the “importdata” function in Matlab, Numpy has “loadtxt”. For exapmle:
Add text to plots
Usually there are two ways:
- Use matplotlib.pyplot.text(xpos, ypos, string). For example:
Extra manipulation such as text wrapping can be found here.
- Use matplotlib.pyplot.annotate. Refer to this link.
Use TeX for rendering text
Working with directory
Sometimes one needs to import many data files to the workspace and plot. This can be realized with the help of package “glob” which is capable of matching wildcards in path patterns. For example,