0% found this document useful (0 votes)
8 views21 pages

Data Visualization Unit 4 - R23

The document discusses the visualization of groups and clusters, emphasizing the importance of clustering algorithms for data analysis and interpretation. It outlines various visualization techniques such as scatter plots, heatmaps, and tree diagrams, as well as their applications in different fields. Additionally, it covers the significance of software visualization and metaphorical visualization in making complex data more accessible and engaging.
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)
8 views21 pages

Data Visualization Unit 4 - R23

The document discusses the visualization of groups and clusters, emphasizing the importance of clustering algorithms for data analysis and interpretation. It outlines various visualization techniques such as scatter plots, heatmaps, and tree diagrams, as well as their applications in different fields. Additionally, it covers the significance of software visualization and metaphorical visualization in making complex data more accessible and engaging.
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

Unit-4

VISUALIZATION OF GROUPS
Visualization of clusters/groups
Clustering algorithms group data objects together based on some notion of distance or similarity.
This resembles visual tasks that are easy for humans: spotting a cluster of stars in the night sky or
identifying a cluster of old houses within a modern city. The human visual system “has evolved to
facilitate quick and considered detection of the visually like and unlike through a wide variety of
cues – e.g. location and relative proximity, movement, shape, colour, texture, and matching
against predetermined patterns. Consequently, visualization is a natural and powerful resource
for cluster analysis; it is especially valuable in identifying unanticipated structure”.
Eg: Companies such as Netflix use the concept of cluster analysis to create product suggestions
for their customers. The better the suggestions, the more likely the customer is to buy products

There are many reasons to perform clustering. Most commonly it is done to better understand the
data (data interpretation), or to efficiently code the data set (data compression).

Data interpretation: Automatically dividing a set of data items into groups is an important way
to analyse and describe the world. Automatic clustering has been used to cluster documents (such
as web pages), user preference data, and many forms of scientific observational data in fields
ranging from astronomy to psychology to biology.

Data compression: Clustering may be used to compress data by representing each data item in a
cluster by a single cluster prototype, typically at the centre of the cluster. Consider Ddimensional
data which has been clustered into K clusters. Rather than representing a data item as a D
dimensional vector, we could store just its cluster index (an integer from 1 to K). This
representation, known as vector quantization, reduces the required storage for a large data set at
the cost of some information loss. Vector quantization is used in image, video and audio
compression.

Types of clustering

There are two main approaches to clustering: hierarchical and partitional. Hierarchical clustering
forms a tree of nested clusters in which, at each level in the tree, a cluster is the union of its
children.

Partitional clustering does not have a nested or hierarchical structure, it simply divides the data
set into a fixed number of non-overlapping clusters, with each data point assigned to exactly one
cluster. The most commonly employed partitional clustering algorithm, K-means clustering.
Whatever approach to clustering is employed, the core operations are distance computations:
computing the distance between two data points, between a data point and a cluster prototype, or
between two cluster prototypes.

Here are some of the best techniques for visualizing clusters and groups in data:
1. Scatter Plots (Colored by Groups or Clusters)
This is one of the most common ways to visualize data points that belong to different clusters.
The points are plotted in a 2D or 3D space, and the clusters/groups are typically distinguished by
color, shape, or size of the points.
Example: You might have two features of customers: age and income. Clustering these
customers using K-means would allow you to visualize the clusters in 2D, with each
cluster represented by a different color.

2. Heatmaps (for Group Comparisons or Similarities)


Heatmaps are excellent for visualizing the similarity between groups or clusters. When we have a
similarity or distance matrix (e.g., from hierarchical clustering), heatmaps can visually display
how similar or different each group or cluster is.

Example: In gene expression data, a heatmap can be used to show the


expression levels of various genes across different clusters of samples.

3. 3D Plot (for Visualizing High-Dimensional Clusters)


When we have three key features, a 3D scatter plot can help visualize clusters/groups in three
dimensions. This is helpful when two dimensions are not enough to separate clusters visually.
Example: Visualizing customer segments based on age, income, and spending.
Visualization of Trees, Graphs and Networks Tree Visualizations

A tree is a hierarchical structure where each node has a single parent (except the root) and can
have multiple children. Visualizing trees is useful for showing structures like decision trees, file
systems, and organizational hierarchies.

A tree is defined as a set of nodes and edges. It can otherwise be defined as a network of
connected nodes where there are no loops. Every edge has a pair of nodes called the parent node
and child node. A child node has only one parent node. The root node which is a single node has
no parents and the leaf nodes have no children. Between any two nodes there exists a unique
path. The depth of a tree is the number of nodes from the root to the leaf.

a. Dendrogram (Hierarchical Tree)

• A dendrogram is a diagram that shows the hierarchical relationship between objects. It is


most commonly created as an output from hierarchical clustering.
• The main use of a dendrogram is to work out the best way to allocate objects to clusters.
The dendrogram below shows the hierarchical clustering of six observations shown on the
scatterplot to the left. (Dendrogram is often miswritten as dendogram.)
How to read a dendrogram
• The key to interpreting a dendrogram is to focus on the height at which any two objects are
joined together. In the example , we can see that E and F are most similar, as the height of
the link that joins them together is the smallest. The next two most similar objects are A
and B.
• In the dendrogram , the height of the dendrogram indicates the order in which the clusters
were joined. A more informative dendrogram can be created where the heights reflect the
distance between the clusters as is shown below. In this case, the dendrogram shows us
that the big difference between clusters is between the cluster of A and B versus that of C,
D, E, and F.

b. Interactive Tree (Radial or Vertical Layout)


• Use Case: Showing hierarchical structures, especially with many nodes, where each level
of the tree has a fixed relationship.
• Key Characteristics: Radial trees spread out from a central point (root), while vertical
trees show parent-child relationships in a top-down manner.
Example: Organizational charts or decision trees.
Radial tree:

The radial graph layout is related to the layered graph layout but visualizes the layers as circles
instead of horizontal lines. Hence, in radial layouts, the circles are often called layers where the
innermost circle is the first layer.

The layout calculation starts by conceptually reducing the input graph to a tree structure and takes
the tree’s root as the center of all circles. Then, the algorithm places each child node in this tree
structure on the next outer circle within the sector of the circle that was occupied by its parent
node.
Graph Visualizations

A graph is a collection of nodes (vertices) and edges (connections between nodes). Graphs can
represent various relationships, including social networks, communication networks, and
dependencies.

Graphs are the most general type of relational data. Similar to a tree, it consists of nodes and
edges but is different from a tree by the concept that a child node may have multiple parent
nodes. A graph contains loops, or multiple paths between two nodes in the graph. Graphs can be
represented by means of Graph Drawing and Graph visualization.

a. Force-Directed Graph (Layout)

• Use Case: Representing networks where nodes are connected and interact with each other
based on certain forces (e.g., repulsion between nodes and attraction between connected
nodes).
• Key Characteristics: The graph layout simulates physical forces, with nodes spaced based
on the strength of their connections.

How to Visualize:

• Nodes arepositioned based on the "attraction" and "repulsion" between them, which
dynamically pushes the graph into an aesthetically balanced layout.
b.
Circular Layout

• Use Case: Displaying graphs where the relationship between nodes is best understood in a
circular structure (e.g., social networks or dependency graphs).
• Key Characteristics: Nodes are arranged in a circle, and edges are drawn between them,
showing relationships clearly.

How to Visualize:

• Nodes are evenly spaced around a circle, with edges connecting them.

Network Visualizations

Network visualizations are often used for larger, more complex systems with many
interconnected nodes. They can represent real-world systems like social networks, communication
networks, biological networks, or even web crawls.

a. Hierarchical Network (Tree-like Structure)

• Use Case: Visualizing hierarchical relationships within a network (e.g., family trees,
organizational charts).
• Key Characteristics: Each node has a single parent, and child nodes are branched out from
the parent.

Example: Corporate organizational chart or biological taxonomy.

b. Interactive Social Network Graph

• Use Case: Displaying the relationships in social networks, where nodes are people or
entities, and edges represent interactions or relationships.
• Key Characteristics: Can highlight important nodes (e.g., central users) and show groups
or communities within the network.

How to Visualize:

• Node size can representthe degree of connectivity (i.e., number of connections). •


Node color can represent a group or community.
• Edge thickness can represent the strength or weight of the connection.
Software visualization
Software visualization refers to the graphical representation of software systems, code, and
related information to aid in understanding, analyzing, and communicating various aspects of
software development.
Software visualization tools are crucial for various reasons in modern software development.
Firstly, these tools provide developers with a clear and comprehensive understanding of complex
software systems. By visualizing code structure, dependencies, and execution paths, developers
can identify potential bottlenecks, design flaws, or areas for optimization more efficiently. This
understanding ultimately leads to improved code quality, reduced technical debt, and enhanced
maintainability of the software.
Secondly, software visualization tools aid in communication and collaboration among team
members. Visual representations of code are often more accessible and understandable than lines
of text, making it easier for developers to convey ideas, discuss architectural decisions, and
onboard new team members.

Types of Software Visualization

Code Visualization
Code Structure Visualization: Represents the organization and structure of code, including
classes, modules, and their relationships.
Code Dependency Visualization: Illustrates dependencies between different components or
modules in a software system.
Execution Visualization
Runtime Behavior Visualization: Shows the dynamic behavior of a program during execution,
helping developers understand the flow of control, data, and interactions between different
components.

Data Flow Visualization

Data Flow Diagrams: Depicts how data moves through a system, showing the flow of information
between various components.

Version Control Visualization

Version History Graphs: Represents the evolution of a codebase over time, including branches,
merges, and changes made by different contributors.

Performance Vizualization

Performance Profiling Charts: Visualizes the performance characteristics of a software system,


helping identify bottlenecks and areas for optimization.

Debugging Visualization

Debugging Visualizations: Aids developers in understanding the execution flow, variable values,
and program state during the debugging process. Metaphorical visualization

Metaphorical visualization in data visualization refers to the use of metaphors to represent


complex data or concepts in a way that makes them more accessible, engaging, or easier to
understand. By drawing on familiar physical objects, processes, or experiences, metaphorical
visualizations can simplify abstract data, making it more relatable and intuitive.

The idea is to map the data to another dataset that is already familiar to the user, and then rely on
their existing knowledge to illustrate relationships in the data.

Key Principles of Metaphorical Visualization

1. Connection to Familiar Concepts: Metaphors tap into people's existing knowledge or


experiences. For example, a "tree" metaphor could represent the hierarchical structure of
a website or an organization, where branches represent categories, subcategories, and
content.
2. Simplification: By translating abstract or complex data into something more tangible,
metaphorical visualizations can help users grasp difficult concepts more easily. For
example, a "water flow" metaphor might be used to describe the movement of data across
a network, helping users understand data traffic or bottlenecks.
3. Engagement: Metaphors can make data exploration more engaging and visually
stimulating. For instance, a "garden" metaphor for a business ecosystem could make the
visualization more appealing and give viewers an emotional or aesthetic connection to the
data.
Examples of Metaphorical Visualization

1. Tree Diagrams:
o A tree metaphor is often used to represent hierarchical structures, such as family
trees, organizational charts, or file systems.
o The metaphor of "growing branches" makes it easy to conceptualize parent-child
relationships and how data can expand from a single point (the root) into various
layers (branches and leaves).
2. Flow or River Metaphor:
o Data flows can be visualized as a river, where the flow represents movement or
progression of data, and the width of the stream can indicate volume or intensity. o
This is often used in network traffic analysis or in visualizing the flow of information
in systems (e.g., email traffic, web traffic).

Benefits of Metaphorical Visualization

1. Enhanced Understanding: Metaphors can simplify complex data and concepts by


presenting them through familiar images, making it easier for users to interpret data
without requiring deep technical knowledge.
2. Accessibility: Using metaphors bridges the gap between experts and non-experts, enabling
a wider audience to engage with the data.

Limitations

• Over-Simplification
• Misleading Interpretations

Various visualization techniques

Data visualization is the process of creating graphical representations of information. This process
helps the presenter communicate data in a way that’s easy for the viewer to interpret and draw
conclusions.
There are many different techniques and tools you can leverage to visualize data, Here
are some important data visualization techniques to know:

• Pie Chart
• Bar Chart
• Histogram
• Gantt Chart
• Heat Map
• Box and Whisker Plot
• Scatter Plot

Pie Chart
Pie charts are one of the most common and basic data visualization techniques, used across a
wide range of applications. Pie charts are ideal for illustrating proportions, or part-to-whole
comparisons.
Because pie charts are relatively simple and easy to read, they’re best suited for audiences who
might be unfamiliar with the information or are only interested in the key takeaways. For viewers
who require a more thorough explanation of the data, pie charts fall short in their ability to
display complex information.

Bar Chart
The classic bar chart, or bar graph, is another common and easy-to-use method of data
visualization. In this type of visualization, one axis of the chart shows the categories being
compared, and the other, a measured value. The length of the bar indicates how each group
measures according to the value.
One drawback is that labeling and clarity can become problematic when there are too many
categories included. Like pie charts, they can also be too simple for more complex data sets.

Histogram
A histogram visually represents numerical data distribution, using bars to show data frequency
within specific intervals, which helps reveal the underlying distribution of continuous data.
Histograms are especially useful for showing the frequency of a particular occurrence. For
instance, if we like to show how many clicks our website received each day over the last week,
we can use a histogram. From this visualization, we can quickly determine which days your
website saw the greatest and fewest number of clicks.

Gantt chart
Gantt charts are particularly common in project management, as they’re useful in illustrating a
project timeline or progression of tasks. In this type of chart, tasks to be performed are listed on
the vertical axis and time intervals on the horizontal axis. Horizontal bars in the body of the chart
represent the duration of each activity.
Utilizing Gantt charts to display timelines can be incredibly helpful, and enable team members to
keep track of every aspect of a project. Even if we are not a project management professional,
familiarizing yourself with Gantt charts can help you stay organized.

Heat Map
Heat maps use color gradients to represent data values, providing a clear visual indication of data
density and variations. They are effective for visualizing geographical data, website engagement
metrics, or any data set with a spatial element.
Benefits of Heat Maps

▪ Pattern recognition: Heat maps make it easy to recognize patterns and trends within large
data sets, highlighting areas of high and low activity.
▪ Geographical insights: They are particularly useful for displaying geographical data,
such as regional sales performance or customer distribution.
▪ User engagement: In web analytics, heat maps can show which areas of a webpage
receive the most interaction, guiding optimization efforts.
Example
A heat map can highlight regions on a map based on the concentration of customer activity or
sales, with warmer colors indicating higher activity and cooler colors indicating lower activity.
This allows marketers to easily identify hotspots where marketing campaigns are most effective
or regions where additional efforts may be needed

A Box and Whisker Plot


A Box plot is a way to visualize the distribution of the data by using a box and some vertical
lines. It is known as the whisker plot. The data can be distributed between five key ranges, which
are as follows:

1. Minimum: Q1-1.5*IQR
2. 1st quartile (Q1): 25th percentile
3. Median:50th percentile
4. 3rd quartile(Q3):75th percentile
5. Maximum: Q3+1.5*IQR

Here IQR represents the InterQuartile Range which starts from the first quartile (Q1) and ends
at the third quartile (Q3).
In the box plot, those points which are out of range are called outliers. We can create the box plot
of the data to determine the following:

o The number of outliers in a


dataset o Is the data skewed or not o
The range of the data
The range of the data from minimum to maximum is called the whisker limit. Outliers are
represented by individual points that are in-line with the whiskers.
This type of chart is helpful in quickly identifying whether or not the data is symmetrical or
skewed, as well as providing a visual summary of the data set that can be easily interpreted.
Scatter Plot
Scatter plots display data points on an x/y axis to show the relationship between two variables.
This type of visualization is excellent for identifying correlations, trends, and outliers within the
data.

Benefits of Scatter Plots

▪ Correlation identification: Scatter plots are ideal for identifying and visualizing
correlations between variables, helping to understand relationships within the data.
▪ Trend analysis: They can reveal trends over time or across different conditions, providing
deeper insights into data behavior.
▪ Outlierdetection: Scatter plots make it easy to spot outliers that may indicate errors or
significant anomalies worth further investigation.
Scatter plots are most effective for fairly large data sets, since it’s often easier to identify trends
when there are more data points present. Additionally, the closer the data points are grouped
together, the stronger the correlation or trend tends to be.
Data structures used in data visualization
Data structures are fundamental to how data is represented, stored, and manipulated for
visualization purposes. Choosing the right data structure is essential for creating efficient,
interactive, and informative visualizations. Different types of visualizations, such as bar charts,
line graphs, heat maps, or network graphs, require different approaches to data organization.
Below are common data structures used in data visualization:

1. Arrays and Lists


An array (or list) is an ordered collection of elements where each element has a specific position
(index) in the sequence. Arrays allow for fast indexing and are often used when the data is
sequential or when the order of the data matters.

Use Cases:
• Bar charts: Each element in the array corresponds to a specific value that will be
represented by the height of the bars.
• Line charts: An array can store x and y values, where each pair of values corresponds to a
data point.
• Scatter plots: An array stores coordinates (x, y) that correspond to the points on the scatter
plot.

Ex: # Data values = [10, 20, 30, 40, 50] categories = ['A', 'B', 'C', 'D', 'E']]# Visualize as a bar
chart with values corresponding to the height of each bar.
Ex: # x and y values x_values
= [1, 2, 3, 4, 5] y_values =
[10, 20, 15, 30, 25]
# These will be the points plotted on a line chart.
2. Dictionaries (Hash Maps)
A dictionary (or hash map) is a collection of key-value pairs, where each key is unique. It
provides very fast lookups based on the key, which is particularly useful when you need to map
one piece of data to another (e.g., category names to specific values).

Use Cases:
• Categorical data: Mapping categories to values for pie charts or bar charts. • Color
mapping: Associating colors with different categories in the visualization.
Groupings: Grouping data by categories, like grouping sales figures by regions.

Ex: # A dictionary mapping months to sales values


# Data sales_data
={
'January': 100,
'February': 150,
'March': 120,
'April': 180
}}
# This data can be used for a bar chart, where months are the x-axis labels, and sales are the
yvalues. Ex: color_mapping = {
"Red": "#FF0000",
"Green": "#00FF00",
"Blue": "#0000FF"
}
# This can be used to assign colors to different categories in a pie chart.

3. Matrices (2D Arrays)


A matrix is essentially a 2D array (a list of lists) and is used for representing tabular data or multi
dimensional datasets. It’s particularly useful for visualizations that require two dimensions, such
as heatmaps and grid-based charts.

Use Cases:
• Heatmaps: A matrix is ideal for storing data points, where each value in the matrix can
represent an intensity or color code for each cell.
• 2D Scatter Plots: Matrices can represent a grid of data points.
• Adjacency Matrices: Used to represent graphs (nodes and edges) in the form of a 2D
matrix where the matrix cell values indicate whether an edge exists between nodes.

Ex:
# A matrix for a heatmap, where each number represents the intensity of color at that position
heatmap_data = [
[1, 2, 3],
[4, 5, 6],
[7, 8, 9]
]
# Each value in the matrix can correspond to a color intensity (e.g., lighter color for higher values).

4. Trees
A tree is a hierarchical data structure where each node has a parent (except the root node), and
nodes can have multiple children. Trees are useful for representing hierarchical relationships or
structures.

Use Cases:
• Hierarchical charts: Trees are commonly used for visualizing organizational charts, family
trees, decision trees, etc.
• Treemaps: A tree structure can be used to represent hierarchical data, where each branch
node is displayed as a rectangle whose size reflects the data.

Ex: # A simple tree structure represented as a dictionary


family_tree = { "Grandparent": {
"Parent1": ["Child1", "Child2"],
"Parent2": ["Child3", "Child4"]
}
}
# This could be used to build a hierarchical family tree chart.
5. Graphs
A graph consists of nodes (vertices) and edges (connections between nodes). Graphs are essential
for representing relationships, networks, or flows of information.

• Adjacency List: A graph can be represented by an adjacency list where each node stores a
list of its neighbors.
• Adjacency Matrix: A 2D array can represent a graph where each cell (i, j) indicates if there
is an edge from node i to node j.

Use Cases:
• Network Visualizations: Graphs are ideal for visualizing networks, like social networks,
web links, or communication networks.
• Flow diagrams: Used in visualizing process flows or dependency relationships.

Ex: # Social network where each person is a node, and each list contains friends (edges) network
={
"Alice": ["Bob", "Charlie"],
"Bob": ["Alice", "David"],
"Charlie": ["Alice"],
"David": ["Bob"]
}
# This can be used to visualize connections in a social graph.
6. Stacks and Queues
• A stack is a data structure where elements are added and removed from the top (Last In,
First Out or LIFO).
• A queue is a data structure where elements are added at the back and removed from the
front (First In, First Out or FIFO).

Use Cases:
• Animation State Management: Stacks and queues can manage the state of animations or
visual transitions in real-time data visualizations.
• Event Handling: Queues can be used for processing events in real-time visualizations.

Ex: # A stack to manage the sequence of animation steps animation_stack


= ["Step 1", "Step 2", "Step 3"]
# Each step could represent a different visual change in an animation.

Ex: # A queue to manage tasks for visualization rendering


task_queue = ["Render bar chart", "Render line chart", "Render scatter plot"] #
Tasks will be processed in the order they are added (FIFO).

You might also like