Lab 0 - Learning MatPlotLib
You'll use Terminal and a web browser for this lab.
Note: I strongly recommend creating a new directory for your CS415 work, and a subdirectory within it for your lab files.
Start a Jupyter Notebook
in Terminal, change to your lab directory
enter the command
if the command fails, try the full pathname:
In the webpage that opens up, click the
New button and choose
At the top of the new notebook page, it says
Untitled. Click this text to rename it to
There is a dropdown menu in the toolbar that says
In the first input box type
## Lab 0 - Prof Carl except with your name instead of mine ;^). Type
Ctrl-Enter to make this your heading.
Other than the last (longest) example, enter each script by hand (do not cut-and-paste), one per
in a Notebook, you can enter the
import statement for
pyplot just once, not repeatedly as they do in tutorial
to run each script, type
Ctrl-Enter inside the
In: box. The first one may take a minute.
ensure your output matches the output in the tutorial examples
make sure you understand the basic idea behind each command
Now replicate the following graph as closely as you can using the data below. Hint:
will give you the blue line but no stars. To get those, combine
; see the docs on scatter
Make the same graph, but flip the axes so numthreads is the x-axis. Which view makes more sense? Play with the graph by changing the color and style of the points and lines.
From the File
menu, choose Download as
. Add a CS415 subdirectory
folder and copy the generated HTML
page to the new folder.
Back in the Notebook, from the File menu choose Close and Halt to shut down the Python kernel. Then you can click Logout on the main Notebook page.
Back in Terminal, you can type <ctrl-c> twice to terminate the Jupyter server.
numThreads = [1,2,3,4]
real = [3.20, 1.68, 1.14, 0.95]