3.
Write a program to display line chart from (2,5) to (9,10):
import [Link] as plt
# Define data points
x = [2, 9] # X-axis points
y = [5, 10] # Y-axis points
# Create the line chart
[Link](x, y)
# Add labels and title
[Link]("X-axis")
[Link]("Y-axis")
[Link]("Line Chart")
# Display the chart
[Link]()
[Link] a program to display a scatter chart for the following points (2,5), (9,10),(8,3),(5,7),(6,18).
Write a Python program to draw a scatter plot comparing two subject marks
of Mathematics and Science. Use marks of 10 students.
Test Data:
math_marks = [88, 92, 80, 89, 100, 80, 60, 100, 80, 34]
science_marks = [35, 79, 79, 48, 100, 88, 32, 45, 20, 30]
marks_range = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100]
Sample Solution:
Python Code:
import [Link] as plt
import pandas as pd
math_marks = [88, 92, 80, 89, 100, 80, 60, 100, 80, 34]
science_marks = [35, 79, 79, 48, 100, 88, 32, 45, 20, 30]
marks_range = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100]
[Link](marks_range, math_marks, label='Math marks', color='r')
[Link](marks_range, science_marks, label='Science marks', color='g')
[Link]('Scatter Plot')
[Link]('Marks Range')
[Link]('Marks Scored')
[Link]()
[Link]()