Q. plt.plot(A, B) produces (A and B are the sequences same as created in question 2) chart as:



Write codes to produce charts as shown below:






Answer :-

(a)


import matplotlib.pyplot as plt
import numpy as np

A = np.arange(2, 20, 2)
B = np.log(A)
plt.plot(A, B)
plt.plot(A  , B * 1.2)

plt.show()


(b)


import matplotlib.pyplot as plt
import numpy as np

A = np.arange(2, 20, 2)
B = np.log(A)
plt.plot(A, B)
plt.plot(A  , B * -1.2)

plt.show()

Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post