Page 261 - Robotics and AI class 10
P. 261

Last 3 rows of the dataset:

                     Name      Age    Gender    Grade
                 2  Jacob      14     Male      78

                 3  Eshaan     17     Male      65
                 4  Snema      16     Female    88

              9.  Plotting x and y point arrays on a plot.

              Ans.  import numpy as np
                 import matplotlib.pyplot as plt
                 # Generate sample data for x and y points

                 x_points = np.array([1, 2, 3, 4, 5])

                 y_points = np.array([5, 9, 7, 3, 8])
                 # Plotting x and y point arrays on a plot

                 plt.figure(figsize=(8, 6))
                 plt.plot(x_points, y_points, marker='o', linestyle='-', color='b', label='Data
                 Points')

                 plt.xlabel('X AXIS')
                 plt.ylabel('Y AXIS')

                 plt.title('Plot of X and Y Point Arrays')

                 plt.legend()
                 plt.grid(True)

                 plt.tight_layout()
                 plt.show()
                 Output:
































                                                                                            Assignment     259
   256   257   258   259   260   261   262   263   264   265   266