Question: Install matplotlib on your machine: Windows: python - m pip install matplotlib Mac: pip 3 install - - user matplotlib Understand graphs.py Modify graphs.py to
Install matplotlib on your machine:
Windows: python m pip install matplotlib
Mac: pip install user matplotlib
Understand graphs.py
Modify graphs.py to label the xaxis as x and the yaxis as y
Modify graphs.py to plot the straight lines with magenta dashes. Hint.
Modify graphs.py to draw the sine wave with point size.
Modify graphs.py by replacing pltxlim and pltylim in the main function with an equivalent pltaxis statement.
Reproduce this graph scores.png as closely as possible.
Assumption: There are students whose student IDs are through
graphs.py:
import matplotlib.pyplot as plt
import numpy as np
#
def plotlinex y x y:
Plot a line using the specified points."""
x x x
y y y
pltplotx y "gold"
#
def plotsinewavestartx stopx amplitude:
Plot a sine wave."""
xarray nplinspacestartx stopx
yarray amplitude npsinxarray
pltplotxarray, yarray, "red"
#
def maingraphmin, graphmax:
pltxlimgraphmin, graphmax
pltylimgraphmin, graphmax
plotlinegraphmin, graphmin, graphmax, graphmax
xarray nparraygraphmin, graphmax
yarray nparraygraphmax, graphmin
pltplotxarray, yarray, "blue"
plotsinewavegraphmin graphmax graphmax
pltshow
#
main
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
