Page 104 - Informatics_Practices_Fliipbook_Class12
P. 104

3                                           DATA VISUALIZATION














          Chapter Outline


          3.1 Displaying the line graph                      3.2 Bar Graph
          3.3 Histogram







        Introduction
        It is said that a picture is worth a thousand words. Visualizing data through graphs, pie charts, histograms, and 3D plots
        allows us to uncover patterns and trends in data that provide useful insights from the data. Using visual representations,
        we can effectively communicate and interpret complex information. For example, line graphs are an excellent choice
        for visualizing stock market trends over time. They allow us to identify patterns, track fluctuations, and make informed
        decisions based on historical data. Pie charts provide an intuitive representation of demographic data, such as gender
        distribution or class composition. Histograms can be employed to showcase the distribution of a single continuous
        variable, such as the percentage marks in a class.
        Python, a powerful and versatile programming language, offers a wide range of libraries for data visualization. Among
        these is Matplotlib, a feature-rich toolkit offering an abundance of tools and functions to craft a diverse assortment of
        visuals. Using these tools, we can draw various shapes (like circles, rectangles, and polygons), histograms, bar charts,
        pie charts, scatter plots.
        Throughout this chapter, we will explore how to create these graphs, and customize these plots by adding label, title,
        and legend in plots, thus, empowering us to craft visually compelling and meaningful visualizations of data that bring
        our data to life.


        3.1 Displaying the line graph

        3.1.1 Displaying a Point

        It is said, "Every great dream begins with a small beginning." Let us begin our journey of data visualization by plotting
        a single point. In Matplotlib, the pyplot module provides a simple interface for creating and customizing plots.
        Below, we plot the point having coordinates (3, 2) as a circle in red color (Fig 3.1):
         >>> import matplotlib.pyplot as plt
         >>> plt.plot(3, 2, 'ro')
         >>> plt.show()


          90   Touchpad Informatics Practices-XII
   99   100   101   102   103   104   105   106   107   108   109