Q. Given four sequences as given below:-
X = [1, 2, 3, 4]
Y = [10, 20, 25, 30]
A = [0.3, 3.8, 1.2, 2.5]
B = [11, 25, 9, 26]
Write a program to plot them in the same chart as:-
• A line graph plotted with X and Y with blue color and having line width as 3.
• A scatter graph plotted with A and B with triangular marker of magenta color.
Answer :-
import matplotlib.pyplot as plt X = [1, 2, 3, 4] Y = [10, 20, 25, 30] A = [0.3, 3.8, 1.2, 2.5] B = [11, 25, 9, 26] plt.plot(X, Y, color = 'b', linewidth = 3) plt.scatter (A, B, color = 'm', marker = '^') plt.show()
Output:-
Post a Comment
You can help us by Clicking on ads. ^_^
Please do not send spam comment : )