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

Write code to produce charts as shown below:

PyPlot
3 Likes
Answer
import numpy as np
import matplotlib.pyplot as plt
A = np.arange(2, 20, 2)
B = np.log(A)
C = np.log(A) * 1.2
plt.plot(A, B)
plt.plot(A, C)
plt.show()
Output

import numpy as np
import matplotlib.pyplot as plt
A = np.arange(2, 20, 2)
B = np.log(A)
C = np.log(A) * (-1.2)
plt.plot(A, B)
plt.plot(A, C)
plt.show()
Output

Answered By
2 Likes
Related Questions
Write the output from the given python code :
import matplotlib.pyplot as plt Months = ['Dec', 'Jan', 'Feb', 'Mar'] Attendance = [70, 90, 75, 95] plt.bar(Months, Attendance) plt.show()Write a program to add titles for the X-axis, Y-axis and for the whole chart in below code.
import matplotlib.pyplot as plt Months = ['Dec', 'Jan', 'Feb', 'Mar'] Attendance = [70, 90, 75, 95] plt.bar(Months, Attendance) plt.show()Write suitable Python code to create 'Favourite Hobby' Bar Chart as shown below :

Also give suitable python statement to save this chart.
Consider the following graph. Write the Python code to plot it. Also add the Title, label for X and Y axis.

Using the following data for plotting the graph
smarks = [10, 40, 30, 60, 55] sname = ["Sahil", "Deepak", "Anil", "Ravi", "Riti"]