Page 129 - Informatics_Practices_Fliipbook_Class12
P. 129

B.  State whether the following statements are True or False:
               1.  When multiple graphs are included in the same figure, this information is included by specifying the labels while invoking
                  the plt.subplot() function for each graph.
               2.  Bar graphs, often known as bar charts, are a common method for displaying categorical data.
               3.  Histograms are popular data visualisation tools that offer a graphical depiction of a dataset's distribution.
               4.  linestyle parameter of plt.plot() specifies the marker style for the point(s). The default marker is 'o', representing
                  a circular marker.
               5.  To customize the x-axis label in a bar graph, we use the function label().

            C.  Fill in the blanks.
               1.  To add a title to a plot, we use the function ___________.
               2.  The function used to create a histogram in matplotlib is ___________.
               3.  To save a plot as an image file, we use the function ___________.
               4.  The function plt.scatter() is used to create a ___________ plot in matplotlib.
            D.  Answer the following questions:
               1.  Assume you have the following dataset of temperatures (in degrees Celsius) observed at various times of the day:
                 [22, 24, 26, 25, 27, 29, 28, 30, 28, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15,
                 14, 13, 12]
                  Using Matplotlib, write a Python program to create a line plot depicting temperature differences throughout the day.
               2.  Consider the following two datasets, each representing the number of subscribers on two YouTube channels over the last
                  six months:
                  Channel1: [1000, 1200, 1300, 1400, 1500, 1600]
                  Channel2: [900, 1000, 1100, 1200, 1300, 1400]
                  Using Matplotlib, write a Python program to create a line plot with markers to compare the growth of both YouTube
                  channels.
               3.  Consider the following list comprising weights of 50 students (in kilograms):

                  [50, 55, 52, 48, 60, 62, 59, 57, 53, 58, 56, 51, 54, 61, 55, 50, 52, 58, 53, 56, 60,
                  57, 49, 63, 61, 54, 51, 59, 55, 57, 53, 52, 55, 56, 50, 57, 60, 58, 53, 52, 59, 61,
                  56, 54, 51, 57, 58, 53, 59, 55]
                  Using Matplotlib, write a Python program to create a histogram to visualize the weight distribution.

               4.  Consider the following dataset comprising the number of hours spent studying for a test by a group of students:
                  [2, 3, 4, 5, 6, 7, 8, 9, 6, 5, 4, 3, 5, 6, 7]
                  Using Matplotlib, write a Python program to create a bar graph to depict the students' study hours.

               5.  Consider the following dataset, including the ages of 40 marathon race participants:
                  [25, 30, 32, 28, 27, 35, 40, 29, 31, 37, 36, 26, 33, 42, 39, 34, 28, 26, 29, 38,
                  41, 30, 31, 35, 37, 28, 36, 39, 31, 33, 29, 32, 34, 37, 30, 28, 31, 39, 40, 33, 35,
                  36, 32, 29, 30]
                  Using Matplotlib, write a Python program to create a histogram to visualise the age distribution.


                                           Previous Years' Questions



               1.  To compare data values of commission earned by salesmen over a year, which of the following type of graph should
                  preferably be used?                                                                          [2023]
                  a. line                                         b. area
                  c. bar                                          d. scatter
             Ans.  c. bar




                                                                                              Data Visualization  115
   124   125   126   127   128   129   130   131   132   133   134