Data Modeling And Visualization (21AD71)
Module – 4
Visualization Tools and Libraries: Overview of popular visualization tools (Tableau, Power BI,
etc.), Introduction to data visualization libraries in programming languages (matplotlib, seaborn etc),
Hands-on workshop: exploring different visualization tools and libraries. Interactive visualizations.
4.1 Overview of Popular Visualization Tools (Tableau, Power BI, etc.)
Data visualization is an essential part of data analytics, enabling users to interpret complex
datasets through graphical representations. Various tools are available to create interactive
visualizations, making it easier to identify patterns, trends, and insights from raw data.
Among the most widely used visualization tools are Tableau and Power BI, both of which provide
powerful features for business intelligence, reporting, and data-driven decision-making. These tools
support multiple data sources and offer interactive dashboards that can be shared with teams for better
collaboration.
This section provides a detailed explanation of Tableau and Power BI, their features, advantages,
disadvantages, and key use cases. Additionally, we will briefly discuss other popular data visualization
tools.
Role of Interactive Data Visualization in Data Analysis:
[1] Improved Data Exploration
Users can zoom, filter, sort, and drill down into data to examine specific patterns, trends, or
anomalies that may not be visible in static visualizations.
[2] Better Understanding of Complex Data
Interactivity helps in breaking down large and complex datasets into manageable views, making it
easier to understand relationships between variables.
[3] Real-Time Analysis
Interactive dashboards can update visuals dynamically when data changes, supporting real-time
monitoring and quick insights.
[4] Pattern and Trend Identification
By interacting with charts (hovering, selecting, highlighting), analysts can easily identify trends,
correlations, and outliers.
[5] Enhanced Decision-Making
Decision-makers can test different scenarios and instantly see the impact, leading to more
informed and confident decisions.
AI&DS UoM, MUSE 1
Data Modeling And Visualization (21AD71)
1. Tableau
1.1 What is Tableau?
Tableau is one of the leading data visualization and business intelligence (BI) tools used by
organizations worldwide. It allows users to connect, analyze, and visualize data using an interactive,
drag-and-drop interface without requiring extensive programming skills. Tableau is widely used in
industries like finance, healthcare, marketing, and retail for data-driven decision-making.
1.2 Key Features of Tableau
• User-Friendly Interface: The drag-and-drop functionality enables users to create
complex visualizations without writing code.
• Wide Range of Data Connectivity: Tableau connects with multiple data sources,
including Excel, SQL databases, Google Sheets, cloud databases (AWS, Google
Cloud, etc.), and big data platforms.
• Interactive Dashboards: Users can build dynamic dashboards that allow real-time
filtering, drill-down analysis, and interactive data exploration.
• Real-Time Data Processing: Tableau can connect to live data sources and update
dashboards in real time, making it useful for monitoring dynamic business
processes.
• Artificial Intelligence & Machine Learning Integration: The "Ask Data" feature
allows users to query datasets using natural language processing (NLP) and
receive instant visual responses.
• Advanced Data Manipulation: Users can clean, transform, and manipulate data
using calculated fields and data blending techniques.
• Multiple Deployment Options: Tableau is available in three versions:
• Tableau Desktop (for individual users)
• Tableau Server (for organizations needing a centralized reporting system)
• Tableau Cloud (fully cloud-based solution)
AI&DS UoM, MUSE 2
Data Modeling And Visualization (21AD71)
1.3 Advantages of Tableau
• Highly intuitive and user-friendly for both beginners and experts.
• Offers a wide variety of charts and visualizations, including bar charts, heatmaps, scatter
plots, and geospatial maps.
• Fast performance when handling large datasets.
• Strong community support and extensive learning resources.
• Supports third-party integrations with Python and R for advanced analytics.
1.4 Disadvantages of Tableau
• Expensive licensing costs, making it less accessible for small businesses.
• Limited customization in free versions, requiring additional tools for complex data
preparation.
• Steep learning curve for advanced features like calculations and scripting.
1.5 Use Cases of Tableau
• Business Intelligence (BI) and Analytics – Used by organizations to analyze sales,
marketing trends, and financial performance.
• Healthcare Analytics – Helps hospitals track patient care, disease outbreaks, and resource
allocation.
• Marketing Performance Tracking – Assists businesses in measuring advertising ROI,
customer engagement, and social media analytics.
AI&DS UoM, MUSE 3
Data Modeling And Visualization (21AD71)
2. Microsoft Power BI
2.1 What is Power BI?
Power BI is a business analytics and data visualization tool developed by Microsoft. It allows
users to visualize data and share insights across an organization or embed them in applications.
Power BI is widely used in enterprises due to its seamless integration with Microsoft applications
like Excel, Azure, and SQL Server.
2.2 Key Features of Power BI
• Seamless Microsoft Integration: Power BI works well with Excel, SharePoint, Azure, and
SQL databases, making it ideal for Microsoft-based environments.
• Pre-Built Data Models: Users can quickly create reports using built-in data models and
templates.
• AI-Driven Insights: Features like Q&A (Natural Language Processing) allow users to
query data in simple English.
• Data Refresh & Automation: Supports scheduled and real-time data updates for automated
reporting.
• Advanced Analytics with DAX & M Language:
• DAX (Data Analysis Expressions): Used for creating advanced calculations in Power BI
reports.
• M Language: Used for data transformations and preprocessing.
• Multiple Deployment Options: Power BI is available in three main versions:
• Power BI Desktop (free version for individual users)
• Power BI Pro (paid version for professionals with collaboration features)
• Power BI Premium (enterprise-level solution with large-scale capabilities)
2.3 Advantages of Power BI
• Lower cost compared to Tableau, making it more accessible to small and medium
businesses.
• Easy to integrate with Microsoft Office tools like Excel and SQL Server.
• AI-powered analytics help generate insights automatically.
Custom visualization support using Python and R scripts.
2.4 Disadvantages of Power BI
• Steep learning curve for advanced users, especially when using DAX formulas.
• Limited visualization options compared to Tableau.
• Performance issues with very large datasets, especially in the free version.
AI&DS UoM, MUSE 4
Data Modeling And Visualization (21AD71)
2.5 Use Cases of Power BI
• Financial Reporting – Helps organizations analyze revenue, expenses, and investment
trends.
• Retail & E-Commerce Analytics – Monitors customer purchases, sales performance, and
inventory management.
• Manufacturing & Supply Chain Management – Optimizes production efficiency and
logistics tracking.
2.6 CREATING A POWER BI REPORT OR DASHBOARD.
Step 1: Download and Install Power BI Desktop
1. Visit the official Power BI website.
2. Click on "Products" and install Power BI Desktop on your computer.
3. Open Power BI Desktop after installation.
Step 2: Import Data into Power BI
1. Open Power BI Desktop.
2. Click on Home → Get Data.
3. Choose your data source (Excel, SQL Server, CSV, Web, etc.).
4. Click Load to import data into Power BI.
AI&DS UoM, MUSE 5
Data Modeling And Visualization (21AD71)
Step 3: Transform Data using Power Query
1. Click on Transform Data to open the Power Query Editor.
2. Perform data cleaning:
o Remove empty rows or columns.
o Change data types (text, numbers, date, etc.).
o Rename column headers if needed.
3. Click Close & Apply to save changes.
AI&DS UoM, MUSE 6
Data Modeling And Visualization (21AD71)
Step 4: Add Visualizations to the Dashboard
1. Select a Chart – Click on a suitable visualization from the Visualizations pane (e.g., Bar
Chart, Pie Chart, Line Chart, Map).
2. Drag & Drop Data Fields – Drag columns from the Data pane into the chart fields (X-Axis,
Y-Axis, Legend, Filters).
3. Customize the Chart – Use the Format (paint roller icon) to adjust colors, labels, fonts,
and data labels.
4. Apply Filters & Interactivity – Add filters and slicers for better data segmentation and
enable cross-filtering.
5. Arrange & Resize – Adjust the placement and size of charts for a clean and structured
dashboard layout
Step 5: Customize and Optimize the Dashboard
1. Add Titles & Descriptions – Use the Text Box from the Insert menu to provide meaningful
titles and descriptions for clarity.
2. Apply Themes & Styles – Customize the dashboard’s appearance by selecting a theme from
the View tab or adjusting colors, fonts, and backgrounds.
3. Enable Drill-through & Tooltips – Set up drill-through pages for deeper analysis and
configure tooltips to show extra insights on hover.
AI&DS UoM, MUSE 7
Data Modeling And Visualization (21AD71)
Step 4: Test and Publish the Dashboard
1. Test Interactivity – Click on visuals and slicers to ensure cross-filtering and interactions
work correctly.
2. Adjust Layout – Resize and arrange visuals to maintain a structured and readable layout.
3. Save & Publish – Save the report and publish it to Power BI Service for sharing and
collaboration.
AI&DS UoM, MUSE 8
Data Modeling And Visualization (21AD71)
3. Comparison: Tableau vs. Power BI
Feature Tableau Power BI
Easier for Microsoft users but complex DAX
Ease of Use More intuitive, drag-and-drop
formulas
Cost Expensive More affordable (Free & Pro versions)
Customization High flexibility in dashboards Strong integration with Microsoft tools
Better for structured data but struggles with
Data Handling Works well with large datasets
massive data
Best with Microsoft products (Excel, SQL,
Integration Supports many third-party tools
Azure)
AI&ML Available (Ask Data, Explain
Strong AI capabilities (Q&A, Smart Narratives)
Features Data)
Deployment Cloud & on-premise Cloud & on-premise
Power BI is better suited for businesses that heavily rely on Microsoft products, while Tableau is
preferred for organizations that require advanced analytics and better visualization flexibility.
4. Other Popular Visualization Tools
1 Google Data Studio
• Free tool for creating interactive dashboards.
• Integrates with Google Analytics, Google Ads, and BigQuery.
• Best for small businesses and digital marketing reports.
2 Qlik Sense
• Offers AI-powered analytics and associative data modeling.
• Used in finance, healthcare, and supply chain management.
3 Looker (by Google)
• Focuses on data exploration and business intelligence.
• Uses LookML, a data modeling language.
• Best for enterprises with large data analytics teams.
AI&DS UoM, MUSE 9
Data Modeling And Visualization (21AD71)
4.2.1 Introduction to data visualization libraries in programming
languages.
Data visualization is a crucial aspect of data analysis, allowing users to understand patterns,
trends, and relationships in data. In programming, several libraries are available to create visual
representations of data. Among the most widely used are Matplotlib and Seaborn, which are
commonly used in Python for data visualization.
Matplotlib: An Introduction
Matplotlib is a powerful data visualization library in Python, mainly used for creating static,
animated, and interactive plots. It is one of the oldest and most widely used libraries for data
visualization, providing extensive customization options.
It is highly flexible and can be used for scientific plotting, business analytics, and exploratory
data analysis (EDA).
1. Components of Matplotlib
Matplotlib has multiple components that work together to create visualizations:
1. Figure: The entire visualization area, which can contain multiple plots.
2. Axes: The area where data is plotted (a figure can have multiple axes).
3. Axis: Represents the X and Y coordinate system.
4. Ticks: Small marks on the axes used for scale representation.
5. Legend: A box that explains symbols and colors used in the plot.
6. Title: The title of the entire figure or a specific plot.
7. Labels: Descriptions for X and Y axes.
2. Features of Matplotlib
• Supports a wide variety of plots (line, bar, scatter, histogram, pie, etc.).
• Fully customizable (colors, markers, styles, grid, etc.).
• Works seamlessly with NumPy, pandas, and SciPy.
• Can create multiple subplots in a single figure.
AI&DS UoM, MUSE 10
Data Modeling And Visualization (21AD71)
• Supports 3D plotting (with mpl_toolkits.mplot3d).
• Interactive visualization support with widgets.
• Can save plots in various formats (.png, .jpg, .svg, .pdf).
3. Importance of Matplotlib
• Helps in understanding complex data through graphical representation.
• Widely used in scientific computing, machine learning, and finance.
• Essential for Exploratory Data Analysis (EDA).
• Used in automation and report generation.
• Plays a crucial role in big data visualization.
4. Advantages of Matplotlib
• Highly customizable plots.
• Extensive documentation and large community support.
• Compatible with multiple platforms and OS.
• Can generate publication-quality figures.
• Works well with Jupyter Notebooks for interactive analysis.
5. Disadvantages of Matplotlib
• Complex syntax for beginners compared to high-level libraries.
• Limited support for handling large datasets efficiently.
• Default visualizations are not as attractive as Seaborn.
1.1 Basic Plotting Functions
These functions generate different types of plots.
Function Description
Creates a line plot by connecting data points with lines. Useful for showing trends
[Link]()
over time.
AI&DS UoM, MUSE 11
Data Modeling And Visualization (21AD71)
Function Description
Creates a scatter plot, which shows the relationship between two variables using
[Link]()
individual data points.
[Link]() Creates a vertical bar chart, used to compare categorical data.
Creates a horizontal bar chart, similar to [Link](), but bars are drawn
[Link]()
horizontally.
Creates a histogram, which shows the distribution of a dataset by grouping data into
[Link]()
bins.
[Link]() Creates a pie chart, representing data as slices of a circle.
1.2 Customization Functions
These functions allow users to modify and enhance plots.
Function Description
[Link](label) Adds a label to the X-axis. Example: [Link]("Time (seconds)")
[Link](label) Adds a label to the Y-axis. Example: [Link]("Temperature (°C)")
Sets a title for the plot. Example: [Link]("Temperature Over
[Link](title)
Time")
Adds a legend that identifies different data series in the plot. Example:
[Link]()
[Link](["Line 1", "Line 2"])
Adds or removes grid lines to make the plot easier to read. Example:
[Link](True/False)
[Link](True)
[Link](min, max) Sets the limits for the X-axis. Example: [Link](0, 10)
[Link](min, max) Sets the limits for the Y-axis. Example: [Link](-1, 1)
1.3 Multiple Plots and Layout
Matplotlib allows multiple plots in a single figure.
AI&DS UoM, MUSE 12
Data Modeling And Visualization (21AD71)
Function Description
[Link](figsize=(w, Creates a new figure and sets its size (width, height). Example:
h)) [Link](figsize=(10, 5))
[Link](rows, cols, Divides the figure into a grid and creates subplots. Example:
index) [Link](2, 2, 1) creates the first subplot in a 2x2 grid.
Creates a grid of subplots automatically. Returns a figure and an
[Link](nrows,
array of axes. Example: fig, axes = [Link](2, 3) creates
ncols)
a 2x3 grid.
1.4 Image Handling
These functions help visualize image data.
Function Description
[Link](image, Displays an image or 2D data as an array of pixels. cmap sets the
cmap="colormap") color mapping (e.g., 'gray', 'viridis').
Adds a color scale to the image. Useful for visualizing heatmaps
[Link]()
or intensity-based plots.
Additional Functions
Function Description
Displays the plot or figure on the screen. Must be called after all
[Link]()
plotting commands.
Saves the figure to a file (PNG, PDF, JPG, etc.). Example:
[Link]("[Link]")
[Link]("[Link]").
[Link]() Clears the current figure, removing all elements.
[Link]() Closes the current figure to free up memory.
AI&DS UoM, MUSE 13
Data Modeling And Visualization (21AD71)
Example:
AI&DS UoM, MUSE 14
Data Modeling And Visualization (21AD71)
Output:
4.2.2 SEABORN: AN INTRODUCTION
Seaborn is a statistical data visualization library built on top of Matplotlib. It simplifies the process
of creating beautiful and informative visualizations, especially for statistical data analysis.
AI&DS UoM, MUSE 15
Data Modeling And Visualization (21AD71)
1. Components of Seaborn
Seaborn does not introduce completely new components but enhances Matplotlib with built-in styles
and functions for statistical visualization. Key components include:
1. Built-in Themes: Pre-defined color styles (darkgrid, whitegrid, dark, white, and ticks).
2. Categorical Plots: Functions like barplot(), boxplot(), violinplot(), etc.
3. Statistical Functions: Supports correlation heatmaps and regression plots.
4. Seamless Integration with pandas: Works well with DataFrames.
2. Features of Seaborn
• Built-in themes for better aesthetics.
• Supports statistical plots like correlation matrices, violin plots, and regression plots.
• Automatic color mapping for different categories.
• Works with pandas DataFrames without needing manual conversion.
• Supports multiple figure styles for consistent visual presentation.
3. Importance of Seaborn
• Used in machine learning model analysis.
• Simplifies statistical visualization.
• Ideal for data science and business analytics.
• Creates publication-ready visualizations.
4. Advantages of Seaborn
• Aesthetic and visually appealing default plots.
• Built-in statistical functions (histograms, regression, etc.).
• Works well with large datasets.
• Requires less code than Matplotlib for advanced plots.
• Provides advanced color palettes for better visualization.
AI&DS UoM, MUSE 16
Data Modeling And Visualization (21AD71)
5. Disadvantages of Seaborn
• Less customizable compared to Matplotlib.
• Does not support all types of plots (e.g., 3D plots).
• Requires Matplotlib as a dependency.
• Can be slower for large datasets.
2.1 Basic Plotting Functions
Function Description
[Link]() Creates a line plot.
[Link]() Creates a scatter plot.
[Link]() Creates a bar chart with statistical aggregation.
[Link]() Creates a histogram.
[Link]() Creates a box plot for statistical distribution.
[Link]() Creates pairwise relationships for numerical variables.
2.2 Statistical and Distribution Plots
Function Description
[Link]() (deprecated) Creates a histogram with a density plot (use [Link]()).
[Link]() Creates a Kernel Density Estimate (KDE) plot.
[Link]() Creates a scatter plot with marginal histograms.
[Link]() Creates a heatmap for correlation matrices.
[Link]() Creates a scatter plot with a regression line.
2.3 Customization Functions
Function Description
sns.set_style() Sets the style (darkgrid, whitegrid, dark, white, ticks).
sns.set_context() Adjusts the size of elements in the plot (paper, notebook, talk, poster).
AI&DS UoM, MUSE 17
Data Modeling And Visualization (21AD71)
Function Description
sns.set_palette() Changes the color palette of plots.
[Link]() Removes spines (borders) from the plot.
2.4 Multi-Plot Functions
Function Description
[Link]() Creates a grid of subplots based on categories.
[Link]() Similar to pairplot(), but offers more customization.
Example:
AI&DS UoM, MUSE 18
Data Modeling And Visualization (21AD71)
Output:
AI&DS UoM, MUSE 19
Data Modeling And Visualization (21AD71)
AI&DS UoM, MUSE 20
Data Modeling And Visualization (21AD71)
AI&DS UoM, MUSE 21
Data Modeling And Visualization (21AD71)
4.2.3 PLOTLY
Plotly is a powerful Python library used for interactive and high-quality visualizations. It supports a
variety of charts and integrates well with Dash, Jupyter Notebook, and web applications.
Plotly is available in two versions:
1. Plotly (Open-source) – Free and supports interactive plotting.
2. Plotly Graphing Library ([Link]-based) – The core visualization engine.
Key Features
1. Interactive Charts
o Zooming, panning, hovering, and live updates.
2. Wide Variety of Visualizations.
o Line charts, bar charts, scatter plots, histograms, heatmaps, 3D plots, geographic
maps, and more.
3. Supports Multiple Programming Languages
o Python, R, Julia, and JavaScript.
4. Integration with Web & Dashboards
o Works with Dash for building web applications.
5. Export Options
o Save plots as PNG, PDF, SVG, and HTML.
6. Customization
o Full control over colors, markers, annotations, and layouts.
7. Offline and Online Mode
o Can work offline (Jupyter, local) or online (with Plotly Cloud).
Main Components
Plotly consists of different submodules for specific tasks:
Module Description
plotly.graph_objects Low-level API for complex plots.
[Link] High-level API for simple charts.
[Link] For input/output operations (saving/loading plots).
plotly.figure_factory Advanced plotting utilities (e.g., distplots).
[Link] For creating subplots.
AI&DS UoM, MUSE 22
Data Modeling And Visualization (21AD71)
Advantages
• Highly Interactive – Allows zooming, panning, and tooltips.
• Web-Friendly – Can embed plots in web applications using Dash.
• Wide Range of Charts – Supports 2D, 3D, and animated visualizations.
• Customizable – Modify layout, color, font, and styling.
• Jupyter Notebook Support – Works seamlessly in Jupyter.
Disadvantages
• Slightly Complex for Beginners – More difficult than Matplotlib.
• Larger File Sizes – Interactive elements increase file size.
• Browser-Dependent – Some visualizations require a web browser to render.
Commonly Used Built-in Functions
Function Description
[Link]() Creates a scatter plot.
[Link]() Generates a line chart.
[Link]() Creates a bar chart.
[Link]() Creates a histogram.
[Link]() Generates a box plot.
[Link]() Creates a violin plot.
[Link]() Generates a pie chart.
[Link]() Creates a treemap visualization.
plotly.graph_objects.Figure() Allows detailed customization of plots.
[Link].write_image() Saves plots as images.
Example:
AI&DS UoM, MUSE 23
Data Modeling And Visualization (21AD71)
AI&DS UoM, MUSE 24
Data Modeling And Visualization (21AD71)
Comparison of Matplotlib, Seaborn, and Plotly in Detail:
Feature Matplotlib Seaborn Plotly
Statistical Interactive
Type Static plots
visualization visualization
Requires more code and Simplifies Matplotlib Easiest to use with
Ease of Use
configuration with pre-styled plots built-in interactivity
Highly customizable, full control Limited customization Interactive but limited
Customization
over design due to auto-styling styling options
Yes (zoom, hover,
Interactivity No No
tooltips)
Statistical analysis, Interactive
Basic plots, full customization,
Best For correlation dashboards, web
complex visualizations
visualization applications
Yes (supports 3D
3D Plots Yes (mpl_toolkits.mplot3d) No surface and scatter
plots)
Heatmaps Yes (imshow()) Yes ([Link]()) Yes ([Link]())
Yes (built-in
Animations Yes (FuncAnimation) No
animation support)
AI&DS UoM, MUSE 25
Data Modeling And Visualization (21AD71)
Feature Matplotlib Seaborn Plotly
Works well with NumPy & Optimized for Pandas Easily integrates with
Data Handling
Pandas but needs more coding DataFrames Pandas & Dash
Heavier (~20MB+)
Installation Size Lightweight (~8MB) Medium (~15MB)
due to interactivity
Fast, optimized for Slower due to
Performance Fast for static plots
statistical graphs interactivity overhead
Yes (supports Dash
Dashboards/Web
No No for web-based
Apps
dashboards)
Popularity High Very High High
4.3 Hands-on workshop: exploring different visualization tools and libraries.
Interactive visualizations.
Note:Follow above example programs and Dashboard Creation steps (Or Lab )
AI&DS UoM, MUSE 26