Page 92 - IPP-12-2024
P. 92

b.  Write the appropriate titles of both the axes.

             c.  Write code to Display legends.
             d.  Display red color for the line.

             e.  Use the line style – dashed.

             f.  Display diamond style markers on data points.
            Solution:

            import matplotlib.pyplot as plt
            day=['Monday','Tuesday','Wednesday','Thursday','Friday']

            inc=[510,350,475,580,600]
            plt.plot(day,inc,label='Income',color='r',linestyle='dashed',marker='D'

            )

            plt.title("The Weekly Income Report")
            plt.xlabel("Days")

            plt.ylabel("Income")
            plt.legend()

            plt.show()

            Output:




















             Program19: Consider the following data of a medical store and plot the data on the line chart
             and customize the chart as you wish:
                       Month                 Masks                  Sanitizer                   Hand wash
                       March                  1500                    4400                         6500

                       April                  3500                    4500                         5000
                        May                   6500                    5500                         5800

                        June                  6700                    6000                         6300
                        July                  6000                    5600                         6200

                      August                  6800                    6300                         4500

             Solution:
             import matplotlib.pyplot as plt
   87   88   89   90   91   92   93   94   95   96   97