Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Assume that we have already issued the following commands: import matplotlib.pyp

ID: 3588180 • Letter: A

Question

Assume that we have already issued the following commands:

import matplotlib.pyplot as plt

fig, ax = plt.subplots()

How do you set the y axis limits to -5 to 5?

Select one:

a. fig.ylim(-5,5)

b. ax.set_ylim(-5,5)

c. ax.ylim(-5,5)

d. set_ylim(-5,5)

e. fig.set_ylim(-5,5)

What library do you have to IMPORT in order to do plotting inside of Python?

Select one:

a. fig.add_subplot

b. matplotlib.pyplot

c. math

d. functools

e. plt.figure

What pyplot command would you issue to show a plot in a notebook? Here we assume that we have already imported matplotlib.

Select one:

a. pyplot.matshow()

b. pyplot.show()

c. pyplot.graph_show()

d. pyplot.display()

e. pyplot.plot_show()

Does the matplotlib library proivides a shortcut form that both creates the Figure object and creates a single subplot axes object?

Select one:

a. Yes

b. No

Can the Axes object allow us to control the size and the resolution of the generated figure?

Select one:

a. No; the Figure object is used for that control.

b. Yes

Explanation / Answer

1)How do you set the y axis limits to -5 to 5?

e. fig.set_ylim(-5,5)

2)What library do you have to IMPORT in order to do plotting inside of Pytho

b. matplotlib.pyplot

3)What pyplot command would you issue to show a plot in a notebook? Here we assume that we have already imported matplotlib.

b. pyplot.show()

4)Does the matplotlib library proivides a shortcut form that both creates the Figure object and creates a single subplot axes object?

a. Yes

5)Can the Axes object allow us to control the size and the resolution of the generated figure?

b. Yes