Page 338 - AI Ver 1.0 Class 10
P. 338

Output:
                                       10.0
                                        9.5
                                        9.0

                                        8.5
                                        8.0

                                        7.5
                                        7.0
                                        6.5
                                        6.0

                                              2       3      4       5       6      7       8
                12.  Using Matplotlib and the given data, Plot a pie chart:

                    Data=[45,23,41,78,65]
               Ans.  Program:
                    from matplotlib import pyplot as plt

                   import numpy as np
                    fig = plt.figure()

                   ax = fig.add_axes([0,0,1,1])
                   ax.axis('equal')

                   Data=[45,23,41,78,65]
                   ax.pie(Data,autopct='%1.2f%%')
                   plt.show()
                    Output:


                                    9.13%

                            16.27%
                                          17.86%




                           30.95%
                                        25.79%






                13.  Using Matplotlib and the given data, plot a scatter chart:

                    Height = [4.5,5.2,4.1,3.5,5]
                   Weight = [34,41,45,56,39]
               Ans.  Program:

                    import matplotlib.pyplot as plt
                   Weight = [34,41,45,56,39]


                        336   Touchpad Artificial Intelligence-X
   333   334   335   336   337   338   339   340   341   342   343