0% found this document useful (0 votes)
20 views45 pages

Download

The document provides an overview of data visualization tools and technologies, focusing on industry-standard tools like Tableau and Power BI. It outlines key features, benefits, and use cases of various visualization tools, as well as hands-on training for creating visualizations using Tableau. The document also emphasizes the importance of data integration, customization, and collaboration in effective data visualization.

Uploaded by

GANESHKASHI93
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views45 pages

Download

The document provides an overview of data visualization tools and technologies, focusing on industry-standard tools like Tableau and Power BI. It outlines key features, benefits, and use cases of various visualization tools, as well as hands-on training for creating visualizations using Tableau. The document also emphasizes the importance of data integration, customization, and collaboration in effective data visualization.

Uploaded by

GANESHKASHI93
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 45

Visvesvaraya Technological University, Belagavi

Centre for Distance and Online Education (CDOE), Mysuru

Module-2 Data Visualization Tools and Technologies


Introduction to Visualization Tools, Overview of industry-standard data visualization
tools (e.g., Tableau, Power BI, etc.), Hands-on training in using selected tools to create
basic visualizations, Advanced Features and Techniques
Exploring advanced features of selected tools for complex visualizations
Techniques for integrating data from various sources into visualization platforms
Introduction to Visualization Tools
Visualization tools are crucial in presenting data, ideas, and insights engagingly and
understandably. Whether used for business analytics, project management, education, or
creative endeavors, these tools help transform complex datasets or abstract concepts into
visual representations such as charts, graphs, and infographics.
What Are Visualization Tools?
Visualization tools are software applications or platforms designed to create visual
representations of information. They assist users in making sense of data by presenting it
in an easy-to-interpret and analyzed way.
Key Features of Visualization Tools:
1. Data Integration: Connect to various data sources, such as Excel, databases,
APIs, or cloud storage.
2. Customization: Adjust layouts, colors, labels, and styles to suit specific
audiences or purposes.
3. Interactive Elements: Enable users to interact with visualizations by zooming,
filtering, or drilling for deeper insights.
4. Collaboration: Share and collaborate on real-time visualizations across teams or
platforms.
5. Export Options: Save visualizations in formats like PDF, PNG, or shareable web
links.
Common Types of Visualization Tools:
1. Business Intelligence (BI) Tools:
o Examples: Tableau, Power BI, Qlik
o Use Case: Business performance dashboards, KPI tracking, and financial
analysis.

1
Visvesvaraya Technological University, Belagavi
Centre for Distance and Online Education (CDOE), Mysuru

2. Data Analysis Tools:


o Examples: R, Python (with libraries like Matplotlib, Seaborn, and Plotly)
o Use Case: Advanced statistical and data-driven analysis.
3. Presentation and Infographic Tools:
o Examples: Canva, Piktochart, Venngage
o Use Case: Infographics, marketing materials, and educational content.
4. Geospatial Tools:
o Examples: Google Maps, ArcGIS, Carto
o Use Case: Mapping and spatial analysis.
5. Specialized Tools:
o Examples: D3.js (JavaScript library for custom visualizations), Chart.js
o Use Case: Tailored visualizations for web development or unique datasets.
Benefits of Using Visualization Tools:
• Enhanced Decision-Making: Simplify data for faster and more informed
decision-making.
• Improved Communication: Effectively communicate complex ideas to a broader
audience.
• Better Engagement: Use dynamic visuals to maintain attention and interest.
• Insights Discovery: Reveal trends, patterns, and anomalies that might go
unnoticed in raw data.
Getting Started with Visualization Tools:
1. Define Your Objective: What message or insight do you aim to convey?
2. Select the Right Tool: Match the tool’s capabilities with your needs.
3. Prepare Your Data: Ensure your data is clean, organized, and relevant.
4. Create and Iterate: Build initial visuals, gather feedback, and refine them.
5. Share and Act: Present your visuals to stakeholders and use them to drive
actions.
Overview of industry-standard data visualization tools (e.g., Tableau, Power BI,
etc.),
Industry-standard data visualization tools are widely used across various sectors for their
advanced capabilities, user-friendly interfaces, and ability to integrate with diverse data

2
Visvesvaraya Technological University, Belagavi
Centre for Distance and Online Education (CDOE), Mysuru

sources. These tools cater to different use cases, from business intelligence and analytics
to creative design and mapping. Below is an overview of some of the most popular and
widely adopted tools in the industry:
1. Tableau
• Overview: Tableau is a powerful business intelligence tool known for its intuitive
interface and robust data visualization capabilities.
• Key Features:
o Drag-and-drop functionality for ease of use.
o Wide range of visualization types (heat maps, scatter plots, dashboards).
o Seamless integration with multiple data sources (databases, spreadsheets,
cloud storage).
o Real-time data analytics and dashboard sharing.
• Use Cases: Sales and marketing analysis, financial reporting, and operational
dashboards.
• Strengths: User-friendly, extensive community support, and scalable solutions.
• Limitations: Higher cost for enterprise versions.
2. Microsoft Power BI
• Overview: A business analytics solution by Microsoft, Power BI allows users to
create and share interactive dashboards and reports.
• Key Features:
o Integration with Microsoft products (Excel, Azure, Teams).
o Natural language query (Q&A) for non-technical users.
o AI-driven insights and predictive analytics.
o Mobile-friendly dashboards.
• Use Cases: Corporate reporting, KPI tracking, and ad-hoc analytics.
• Strengths: Affordable pricing and seamless integration within Microsoft
ecosystems.
• Limitations: Steeper learning curve for non-Microsoft users
3. Qlik Sense
• Overview: Qlik Sense is a self-service BI tool focused on data discovery and real-
time collaboration.

3
Visvesvaraya Technological University, Belagavi
Centre for Distance and Online Education (CDOE), Mysuru

• Key Features:
o Associative data engine for uncovering hidden insights.
o AI-driven recommendations for data analysis.
o Interactive dashboards with customizable options.
o Cloud and on-premises deployment.
• Use Cases: Data exploration, scenario modeling, and forecasting.
• Strengths: Strong focus on data relationships and exploratory analytics.
• Limitations: This may require technical expertise for advanced customization.
4. Google Data Studio
• Overview: A free tool for creating customizable, shareable, interactive
dashboards.
• Key Features:
o Integration with Google’s ecosystem (Google Analytics, Sheets,
BigQuery).
o Drag-and-drop report building.
o Real-time collaboration and sharing.
o Free templates for quick setup.
• Use Cases: Digital marketing performance, website analytics, and quick
reporting.
• Strengths: Free to use, user-friendly for beginners.
• Limitations: Limited advanced features compared to premium tools.
5. D3.js
• Overview: A JavaScript library for creating custom, interactive visualizations on
the web.
• Key Features:
o High customization through code.
o Extensive range of visualization options (custom charts, interactive maps).
o Supports large datasets and advanced animations.
• Use Cases: Tailored data visualizations for web-based platforms.
• Strengths: Flexibility and creative control.
• Limitations: Requires programming knowledge in JavaScript.

4
Visvesvaraya Technological University, Belagavi
Centre for Distance and Online Education (CDOE), Mysuru

6. Looker (Google Cloud)


• Overview: A modern BI tool for advanced data analysis and integration with
Google Cloud services.
• Key Features:
o SQL-based data modeling and visualization.
o Real-time analytics for large-scale data.
o Embedded analytics for custom application integrations.
• Use Cases: Enterprise-level data management, embedded analytics.
• Strengths: Robust integration with cloud data warehouses.
• Limitations: Steep learning curve for non-technical users.
7. IBM Cognos Analytics
• Overview: An AI-powered BI platform that offers data visualization, reporting,
and predictive analytics.
• Key Features:
o Automated data preparation and insights generation.
o Advanced analytics with natural language processing.
o Scalable for enterprise usage.
• Use Cases: Enterprise reporting, risk analysis, and operational insights.
• Strengths: Strong AI capabilities and robust security.
• Limitations: Higher cost and complexity for smaller organizations.
8. Plotly (Dash)
• Overview: An open-source graphing library and a framework for building web-
based dashboards.
• Key Features:
o Interactive, publication-quality charts.
o Dash framework for Python developers to build custom web apps.
o Supports multiple languages (Python, R, JavaScript).
• Use Cases: Scientific data analysis, research, and customized dashboards.
• Strengths: Free, open-source library with extensive customization.
• Limitations: This may require programming expertise.
9. Sisense

5
Visvesvaraya Technological University, Belagavi
Centre for Distance and Online Education (CDOE), Mysuru

• Overview: A full-stack BI tool specializing in embedded analytics and handling


complex datasets.
• Key Features:
o Combines data preparation and visualization in one platform.
o Scalable to handle large datasets efficiently.
o Strong embedding capabilities for custom applications.
• Use Cases: Enterprise analytics, operational insights, and customer-facing
dashboards.
• Strengths: Excellent for embedding analytics into products.
• Limitations: Higher costs and resource-intensive.
10. SAP Analytics Cloud
• Overview: A comprehensive tool for analytics and planning integrated with SAP
applications.
• Key Features:
o Unified analytics and planning on a single platform.
o Predictive and machine learning capabilities.
o Real-time data connectivity to SAP systems.
• Use Cases: Enterprise resource planning (ERP), financial planning, and supply
chain analytics.
• Strengths: Best suited for SAP users.
• Limitations: Expensive and complex setup for non-SAP users.
These tools cater to different needs, from simple reporting to advanced analytics. The
best choice depends on your use case, budget, technical expertise, and project scale.
Hands-on training in using selected tools to create basic visualizations, Advanced
Features and Techniques
Exploring advanced features of selected tools for complex visualizations.
Techniques for integrating data from various sources into visualization platforms.
Data Visualization Using Tableau
Introduction to Tableau and Installation: - Tableau is a data visualization tool that
provides pictorial and graphical data representations. It is used for data analytics and
business intelligence. Tableau provides limitless data exploration without interrupting the

6
Visvesvaraya Technological University, Belagavi
Centre for Distance and Online Education (CDOE), Mysuru

flow of analysis. With an intuitive drag-and-drop interface, users can uncover hidden
insights in data and make smarter decisions faster. Tableau can be downloaded from the
following website: https://www.tableau.com/products/public/download

Provide the essential information and start downloading Tableau publicly. After
downloading, the screen will appear.

Click the license agreement checkbox and then click the install button. After installation,
click the Tableau Public icon to run Tableau. The following is the Tableau Public Home
screen.

7
Visvesvaraya Technological University, Belagavi
Centre for Distance and Online Education (CDOE), Mysuru

Connecting to Data and preparing data for visualization in Tableau


Tableau supports connecting to a wide variety of data stored in various places. For
example, data might be stored on a computer in a spreadsheet or a text file, in a big data,
relational, or cube (multidimensional) database on a server in an enterprise, or the data
can be from a public domain available on the web. Data can be imported into Tableau
Public from the Connect panel on the left side. For example, an Excel sample data set
was loaded into Tableau as follows:

8
Visvesvaraya Technological University, Belagavi
Centre for Distance and Online Education (CDOE), Mysuru

Note – Live v/s Extract Data – Live data – whatever change is made in the source data
file will be reflected on the Tableau environment. Tableau won’t update the source file
data update.
After clicking on open, the screen is as follows:

The data store page appears as above. The left pane shows that the above dataset consists
of 3 worksheets. If we drag the orders table, the screen appears as follows: Tableau
automatically identifies the data type of each column.

9
Visvesvaraya Technological University, Belagavi
Centre for Distance and Online Education (CDOE), Mysuru

Now drag the Returns table onto the Canvas to the right of the Orders table. This shows
the relationship between the two tables, Orders and Returns.
If we click on the link between Orders and Returns, the table names at the top summarize
the relationship between the tables. Now, rename the data store and click on Sheet1 at the
bottom left to proceed. This step creates a data extract that improves query performance.
Note: Tableau divides the data into two main types: dimensions and measures.
Dimensions are usually fields that cannot be aggregated, e.g., Gender, Location, etc.
Measures are those fields that can be measured and aggregated or used for mathematical
operations. E.g. sales, profit, salary, etc.,

Click Here

10
Visvesvaraya Technological University, Belagavi
Centre for Distance and Online Education (CDOE), Mysuru

Data Source Pane

Data Visualization
In Tableau, we can perform various visualization operations on data. Some examples are
bar charts, histograms, bubble charts, Gantt charts, scatter plots, and heat maps.
Bar chart: Bar charts can be created in three variations in Tableau: horizontal bars,
stacked bars, and side-by-side bars. Horizontal bars can be made by selecting that type of
chart from the Show Me menu on the right side of Canvas. The chart type in the box on
the right-hand side represents a horizontal bar chart.

Similar to the above, a stacked bar chart can be created, and the result is shown below.

11
Visvesvaraya Technological University, Belagavi
Centre for Distance and Online Education (CDOE), Mysuru

A side-by-side bar chart can be created in the following way.

Line graph:
Line graphs can be continuous or discrete. The continuous line graph is shown below:

12
Visvesvaraya Technological University, Belagavi
Centre for Distance and Online Education (CDOE), Mysuru

A discrete line graph is shown below:

Pie chart:

13
Visvesvaraya Technological University, Belagavi
Centre for Distance and Online Education (CDOE), Mysuru

Bubble chart:

Heat map:

14
Visvesvaraya Technological University, Belagavi
Centre for Distance and Online Education (CDOE), Mysuru

Donut Chart: Data arranged in columns or rows only on a worksheet can be plotted in a
doughnut chart. Like a pie chart, a doughnut chart displays the relationship of parts to a
whole, but a doughnut chart can encompass more than one data series. Each data series
that you plot in a doughnut chart adds a ring to the chart. The first data series is displayed
in the center of the chart.
Because of their circular nature, doughnut charts are not easy to read, especially when
they display multiple data series. The proportions of outer rings and inner rings do not
represent the size of the data accurately — data points on outer rings may appear larger
than data points on inner rings, while their actual values may be smaller. Displaying
values or percentages in data labels is very useful in a doughnut chart, but if you want to
compare the data points side by side, you should use a stacked column or stacked bar
chart instead.
Consider using a doughnut chart when:
▪ You have one or more data series that you want to plot.
▪ All the values that you want to plot must be positive.
▪ None of the values you want to plot is zero (0)
▪ You don't have more than seven categories per data series.
▪ The categories represent parts of the whole in each ring of the doughnut chart.
When you create a doughnut chart, you can choose one of the following doughnut chart
subtypes:
▪ Doughnut: Doughnut charts display data in rings, where each ring represents a
data series. If percentages are displayed in data labels, each ring will total 100%.

15
Visvesvaraya Technological University, Belagavi
Centre for Distance and Online Education (CDOE), Mysuru

▪ Exploded Doughnut: Much like exploded pie charts, exploded doughnut charts
display the contribution of each value to a total while emphasizing individual
values, but they can contain more than one data series.

16
Visvesvaraya Technological University, Belagavi
Centre for Distance and Online Education (CDOE), Mysuru

17
Visvesvaraya Technological University, Belagavi
Centre for Distance and Online Education (CDOE), Mysuru

18
Visvesvaraya Technological University, Belagavi
Centre for Distance and Online Education (CDOE), Mysuru

Data aggregation and statistical functions:


Tableau offers a robust set of calculation tools that allow you to manipulate, transform,
and analyze your data in various ways. Here's an overview of some key concepts related
to Tableau calculations, including SUM, AVG (average), and aggregate functions, as
well as creating custom calculations and fields
We can apply various functions to data, such as count, minimum, maximum, standard
deviation, variance, etc. This is shown below. You can do this by right-clicking on the
required field of the dataset, clicking on Default properties, and clicking on aggregation.

19
Visvesvaraya Technological University, Belagavi
Centre for Distance and Online Education (CDOE), Mysuru

The above operation can also be done by creating a calculated field, as shown below. To
create a calculated field, click the down arrow button beside the search tab above the
Tables panel and drag a field to that calculated field window.

Then click on apply, and the results are shown below:

20
Visvesvaraya Technological University, Belagavi
Centre for Distance and Online Education (CDOE), Mysuru

AVG (Average) Function: The AVG function calculates a numeric field's average (mean)
value. Like SUM, you can use it by dragging a numeric field into the "AVG" shelf or
creating a calculated field with the AVG function.

21
Visvesvaraya Technological University, Belagavi
Centre for Distance and Online Education (CDOE), Mysuru

Aggregate Functions:
Tableau provides a range of aggregate functions that allow you to perform calculations
on data groups. Typical aggregate functions include SUM, AVG, COUNT, MIN
(minimum value), and MAX (maximum value). These functions are beneficial when you
want to analyze data at different levels of granularity (e.g., by category, region, or time).
In the same way, calculated fields allow us to apply any aggregate or statistical function
to data.

Creating Custom Calculations


Tableau allows you to create custom calculations using calculated fields. Here's how to
make a custom calculation: 1. Create a New Calculated Field in the Data Source Pane,
right-click on your data source, and select "Create Calculated Field."

22
Visvesvaraya Technological University, Belagavi
Centre for Distance and Online Education (CDOE), Mysuru

1. Alternatively, you can create a calculated field by right-clicking on a shelf


in your worksheet and choosing "Create Calculated Field."
2. Enter Your Calculation: In the calculated field editor, you can use
functions, operators, and field references to define your calculation. For
example, you can create a calculated field to calculate profit margin as
(SUM([Profit]) / SUM([Sales])) * 100.
3. Name and Save the Calculated Field: Give your calculated field a
meaningful name. Click the "OK" or "Apply" button to save the calculated
field.

23
Visvesvaraya Technological University, Belagavi
Centre for Distance and Online Education (CDOE), Mysuru

4. Use the Calculated Field in Your Worksheet: You can now use the
calculated field like any other field in your worksheet. Drag it to the Rows
or Columns shelf, use it in filters, or create visualizations based on it.

Applying New Data Calculations to Visualizations


Drag and Drop Calculated Fields: To apply your newly created calculated fields to a
visualization, drag and drop them onto the appropriate shelves in your worksheet. For
example, you can drag a calculated field to the Rows or Columns shelf, use it in filters, or
place it on the Marks card to control the appearance of marks.

Drag and Drop

24
Visvesvaraya Technological University, Belagavi
Centre for Distance and Online Education (CDOE), Mysuru

Filter with Calculated Fields: Create filters using calculated fields to control which data
points are displayed in your visualization. You can use calculated fields to filter by
specific criteria, such as a computed date range or a custom ranking.

25
Visvesvaraya Technological University, Belagavi
Centre for Distance and Online Education (CDOE), Mysuru

Formatting Visualizations
Click
Tableau provides a wide range of formatting options to make your visualizations more
appealing and informative:
Format Pane: On the left side of the Tableau interface, you'll find the Format pane. It
allows you to format various aspects of your visualization, such as fonts, colors, lines,
shading, and borders. Select the element you want to format and use the options in the
Format pane to make changes.

26
Visvesvaraya Technological University, Belagavi
Centre for Distance and Online Education (CDOE), Mysuru

Marks Card:
The Marks card, located above your visualization, offers formatting options specific to
the type of marks you're using (e.g., color, size, label). Click on the Marks card to access
these options and modify how your data is represented.

Axis and Gridlines:


You can format axis labels, titles, and gridlines to improve the readability of your
visualization. Right-click on an axis or gridline to access formatting options.

27
Visvesvaraya Technological University, Belagavi
Centre for Distance and Online Education (CDOE), Mysuru

Legends and Color Scales:


Customize legends and color scales to provide context for your visualizations. You can
change colors, labels, and the position of legends to match your data.

Formatting Tools and Menus


Tableau provides several formatting tools and menus to help you refine the appearance of
your visualizations:
Format Menu:
The menu at the top of the Tableau interface provides various formatting options,
including font styles, shading, borders, and alignment. This menu can format text, labels,
and other elements.

28
Visvesvaraya Technological University, Belagavi
Centre for Distance and Online Education (CDOE), Mysuru

Worksheet Menu:
In the Worksheet menu, you'll find options to format the worksheet, including
background color, borders, and worksheet title. You can also adjust the worksheet size.

Dashboard Menu:
If you're working with dashboards, the Dashboard menu allows you to format the entire
dashboard layout, including background, size, and title.

29
Visvesvaraya Technological University, Belagavi
Centre for Distance and Online Education (CDOE), Mysuru

Formatting Specific Parts of the View


Tableau lets you format specific elements of your visualization:
Annotations:
You can add annotations to your visualizations to highlight essential points or provide
additional context. Format these annotations using the options available when you right-
click on an annotation.

Click Here

Tooltips:
Customize tooltips to display relevant information when users hover over data points.
You can format tooltips to show or hide specific fields and control their appearance.

30
Visvesvaraya Technological University, Belagavi
Centre for Distance and Online Education (CDOE), Mysuru

Headers and Titles:


Format headers, titles, and subtitles for clarity and consistency. Use the Format pane or
the Format menu to adjust text formatting, alignment, and shading.

31
Visvesvaraya Technological University, Belagavi
Centre for Distance and Online Education (CDOE), Mysuru

Manipulating Data in Tableau data

New Column (Calculated Fields)

32
Visvesvaraya Technological University, Belagavi
Centre for Distance and Online Education (CDOE), Mysuru

Calculated fields can be used to create customized logic for manipulating certain data
types or values. Tableau offers a wide range of functions that can be used individually or
collectively for data manipulation.

Pivoting Tableau Data


Data pivoting enables you to rearrange the columns and rows in a report so you can view
data from different perspectives.

Dashboards
A dashboard is a way of displaying various types of visual data in one place. It is usually
intended to convey different but related information in an easy-to-digest form. This often
includes things like key performance indicators (KPI) or other important business metrics
that stakeholders need to see and understand at a glance.

33
Visvesvaraya Technological University, Belagavi
Centre for Distance and Online Education (CDOE), Mysuru

Dashboards are helpful across different industries and verticals because they’re highly
customizable. They can include data of all sorts with varying date ranges to help you
understand what happened, why it happened, what may happen, and what action should
be taken.
For example, the region is the field added to the sales category across months in a year.
The first view is shown below. This can be renamed at the bottom of the screen.

Now, go to the second sheet to create the second view. The second view is shown below.
A bubble chart was drawn between profit and subcategory. Then, rename the sheet.

34
Visvesvaraya Technological University, Belagavi
Centre for Distance and Online Education (CDOE), Mysuru

The next 3rd view is created for profit for each subcategory in the category with
averages.

After creating individual views, now a Dashboard can be created by clicking on create
dashboard at the toolbar.

35
Visvesvaraya Technological University, Belagavi
Centre for Distance and Online Education (CDOE), Mysuru

After clicking on the new dashboard option, the screen is shown below.

Now, the sheets or views that were created earlier can be dragged and dropped on this
dashboard. The above three created views are placed in the dashboard as follows. One
can follow their way of importing sheets on the dashboard. After making a dashboard, the
title can be given to it from the Dashboard tab. The dashboard can be customized in terms
of its appearance by the user if required. Once created, the dashboard can be saved on the
user's system and can be retrieved whenever needed.

36
Visvesvaraya Technological University, Belagavi
Centre for Distance and Online Education (CDOE), Mysuru

Basic Visualization in Python


Python has different modules for visualizing data, such as Matplotlib and Seaborn.
Matplotlib is a comprehensive library for creating static, animated, and interactive
visualizations in Python. It presents data in 2D graphics. Seaborn is a visualization library
that is built on top of Matplotlib. It provides data visualizations that are typically more
aesthetic and statistically sophisticated. Matplotlib can be installed using the following
command:
pip install matplotlib
Once the module is installed, it must be imported into the program using the following
command: import ‘matplotlib’ as mpl, where mpl is the alias name given to the
matplotlib library. matplotlib.pyplot is a state-based interface to matplotlib.
matplotlib.pyplot is a collection of functions that make matplotlib work like MATLAB.
Each pyplot function makes some change to a figure: e.g., creates a figure, creates a
plotting area in a figure, plots some lines in a plotting area, decorates the plot with labels
etc. pyplot can be imported into the program using the following command import
matplotlib.pyplot as plt
Following are some of the basic data visualization plots
1. Line plots
2. Area plots
3. Histograms

37
Visvesvaraya Technological University, Belagavi
Centre for Distance and Online Education (CDOE), Mysuru

4. Bar charts
5. Pie charts
6. Box plots
7. Scatter plots
Line Plots:
Program:
import matplotlib. pyplot as plt
x = [1, 2, 3, 4, 5, 6]
y = [1, 5, 3, 5, 7, 8]
plt.plot(x, y)
plt.show()
A line plot represents quantitative values over a continuous interval or time period. It is
generally used to depict trends in the data's change over time.
Output:

Area Plots:
An Area Plot, also called an Area Chart, is used to display the magnitude and proportion
of multiple variables.
Program:

38
Visvesvaraya Technological University, Belagavi
Centre for Distance and Online Education (CDOE), Mysuru

import matplotlib.pyplot as plt


days = [1,2,3,4,5]
sleeping =[7,8,6,11,7]
eating = [2,3,4,3,2]
working =[7,8,7,2,2]
playing = [8,5,7,8,13]
plt.plot([],[],color='m', label='Sleeping', linewidth=5)
plt.plot([],[],color='c', label='Eating', linewidth=5)
plt.plot([],[],color='r', label='Working', linewidth=5)
plt.plot([],[],color='k', label='Playing', linewidth=5)
plt.stackplot(days, sleeping,eating,working,playing, colors=['m','c','r','k'])
plt.xlabel('x')
plt.ylabel('y')
plt.title('Stack Plot')
plt.legend()
plt.show()
Output:

Histograms:
Histograms represent the frequency distribution of a dataset. They are graphs showing the
number of observations within each given interval.
Program:

39
Visvesvaraya Technological University, Belagavi
Centre for Distance and Online Education (CDOE), Mysuru

import matplotlib.pyplot as plt


population_age=[22,55,62,45,21,22,34,42,42,4,2,102,95,85,55,110,120,70,65,55,111,115
,80]
bins = [0,10,20,30,40,50,60,70,80,90,100]
plt.hist(population_age, bins, histtype='bar', rwidth=0.8)
plt.xlabel('age groups')
plt.ylabel('Number of people')
plt.title('Histogram')
plt.show()
Output:

Bar Charts:
A Bar chart or bar graph presents categorical data with rectangular bars whose heights or
lengths are proportional to the values they represent. A bar plot represents data in which
the length of the bars represents the magnitude/size of the feature/variable.
Program:
from matplotlib import pyplot as plt
plt.bar([0.25,1.25,2.25,3.25,4.25],[50,40,70,80,20],label="BMW",width=.5)
plt.bar([.75,1.75,2.75,3.75,4.75],[80,20,20,50,60],label="Audi", color='r',width=.5)
plt.legend()
plt.xlabel('Distance (kms)')
plt.title('Information')
plt.show()

40
Visvesvaraya Technological University, Belagavi
Centre for Distance and Online Education (CDOE), Mysuru

Output:

Pie Charts:
A Pie chart is a circular statistical chart which is divided into sectors to illustrate
numerical proportions.
Program:
import matplotlib.pyplot as plt
days = [1,2,3,4,5]
sleeping =[7,8,6,11,7]
eating = [2,3,4,3,2]
working =[7,8,7,2,2]
playing = [8,5,7,8,13]
slices = [7,2,2,13]
activities = ['sleeping','eating','working','playing']
cols = ['c','m','r','b']
plt.pie(slices, labels=activities, colors=cols, startangle=90, shadow= True,
explode=(0,0.1,0,0), autopct='%1.1f%%')

41
Visvesvaraya Technological University, Belagavi
Centre for Distance and Online Education (CDOE), Mysuru

plt.title('Pie Plot')
plt.show()
Output:

Box Plots:
A Box plot (or box-and-whisker plot) shows the distribution of quantitative data in a way
that facilitates comparisons between variables or across levels of a categorical variable.
The box plot shows the quartiles of the dataset, while the whiskers encompass the rest of
the distribution but leave out the points that are the outliers.
Program:
import matplotlib.pyplot as plt
x=[1,2,3,4,5,6,7]
y=[1,2,4,5,3,6,9]
z=[x,y]
plt.boxplot(z,labels=[“A”,“B”,],showmeans=True)
plt.show()
Output:

42
Visvesvaraya Technological University, Belagavi
Centre for Distance and Online Education (CDOE), Mysuru

Scatter Plots:
A Scatter chart, also called a scatter plot, shows the relationship between two variables.
Program:
import matplotlib.pyplot as plt
x=[1,1.5,2,2.5,3,3.5,3.6]
y=[7.5,8,8.5,9,9.5,10,10.5]
x1=[8,8.5,9,9.5,10,10.5,11]
y1=[3,3.5,3.7,4,4.5,5,5.2]
plt.scatter(x,y, label='high income low saving',color='r')
plt.scatter(x1,y1,label='low income high savings',color='b')
plt.xlabel('saving*100')
plt.ylabel('income*1000')
plt.title('Scatter Plot')
plt.legend()
plt.show()
Output:

43
Visvesvaraya Technological University, Belagavi
Centre for Distance and Online Education (CDOE), Mysuru

Basic Visualization in R
1. Scatter plots
2. Line plots
3. Box plots
4. Histograms
5. Bar charts
ggplot2 is an open-source data visualization package for the statistical programming
language R. ggplot is enriched with customized features to make visualization better.
ggplot2 is a system for declaratively creating graphics, based on The Grammar of
Graphics. ggplot2 can greatly improve the quality and aesthetics of graphics.
The ggplot2 package can be easily installed using the following R function: install.
packages(ggplot2) then the following command must be used in program to use ggplot
package:
library(ggplot2) Consider the following dataset named surveys. All the visualizations
mentioned above are applied on this dataset.
Surveys<-data.frame(record_id=c(1,2,3,4,5),
month=c(7,7,7,7,7),day=c(16,16,16,17,17),year=c(1977,1977,1977,1977,1977),plot_id=c
(2,3
,2,7,3),species_id=c(NL,NL,DM,DM,DM),sex=c(M,M,F,M,M),hindfoot_length=c(32,33
,37, 36,35))

44
Visvesvaraya Technological University, Belagavi
Centre for Distance and Online Education (CDOE), Mysuru

Scatter plot: ggplot(data = surveys, mapping = aes(x = weight, y = hindfoot_length)) +


geom_point(alpha = 0.1, color = "blue“)
Output:
Histogram:
ggplot(surveys, aes(species) + geom_histogram(binwidth = 2)+ labs(title = "Histogram")
Output:
bar chart: ggplot(surveys, aes(species.id)) + geom_bar(fill = "red")+ labs(title = "Bar
Chart") Output:
Box plot:
ggplot(data = surveys, mapping = aes(x = species_id, y = weight)) + geom_boxplot()
Output:

45

You might also like