Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Data Visulization and Power Bi Lab Manual

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 42

SKILL DEVELOPMENT COURSE (DATA VISUALIZATION –R

PROGRAMMING/POWER BI)

Lab Problems
1. Understanding Data, What is data, where to find data, Foundations for building
Data Visualizations, Creating Your First visualization?
Solution:
What is Data?
Data refers to raw facts, statistics, or information collected or stored in a structured or unstructured form.
Data can take various forms, such as text, numbers, images, videos, and more. It is the foundation of all
information and knowledge and is used in various fields for analysis, decision-making, and understanding
trends and patterns.
Data can be categorized into two main types:
 Structured Data: This type of data is organized into a specific format, such as tables or databases,
and is easily searchable and analyzable. Examples include spreadsheets, relational databases, and
CSV files.
 Unstructured Data: Unstructured data lacks a specific format and can include text documents,
social media posts, images, audio recordings, and more. Analyzing unstructured data often requires
advanced techniques like natural language processing and image recognition.
Where to Find Data?
You can find data from various sources, depending on your specific needs:
 Open Data Portals: Many governments and organizations provide free access to a wide range of
data through open data portals. Examples include Data.gov (United States) and data.gov.uk (United
Kingdom).
 Data Repositories: Academic institutions, research organizations, and data enthusiasts often share
datasets on platforms like Kaggle, GitHub, and the UCI Machine Learning Repository.
 APIs (Application Programming Interfaces): Some websites and services offer APIs that allow
you to programmatically access and retrieve data. Examples include Twitter API, Google Maps API,
and financial market APIs.
 Web Scraping: You can extract data from websites using web scraping tools and libraries like
BeautifulSoup and Scrapy. However, be mindful of the website's terms of use and legal restrictions.
 Surveys and Surveys: You can conduct your own surveys or collect data through questionnaires
and interviews.
 IoT Devices: Internet of Things (IoT) devices generate vast amounts of data that can be used for
various purposes.
 Commercial Data Providers: Some companies specialize in selling datasets for specific industries,
such as market research, finance, and healthcare.
Foundations for Building Data Visualizations:
Creating effective data visualizations requires a strong foundation in several key areas:
 Data Analysis: Before creating visualizations, you should thoroughly analyze your data to
understand its structure, relationships, and any patterns or trends. Exploratory data analysis (EDA)
techniques can help with this.
 Statistical Knowledge: Understanding basic statistics is essential for making meaningful
interpretations of data. Concepts like mean, median, standard deviation, and correlation are
commonly used in data visualization.
 Domain Knowledge: Having knowledge of the specific domain or subject matter related to your
data is crucial for creating contextually relevant visualizations. It helps you ask the right questions
and provide valuable insights.
 Visualization Tools: Familiarize yourself with data visualization tools and libraries such as
matplotlib, Seaborn, ggplot2, D3.js, and Tableau. Each tool has its strengths and can be used for
different types of visualizations.
 Design Principles: Study design principles, including color theory, typography, and visual
hierarchy, to create visually appealing and effective visualizations. Avoid common pitfalls like
misleading visualizations.
 Interactivity: Learn how to add interactive elements to your visualizations to engage users and
allow them to explore the data. This can be achieved using tools like JavaScript, Python libraries, or
dedicated visualization software.
Creating Your First Visualization:
To create your first data visualization, follow these general steps:
 Select Your Data: Choose a dataset that aligns with your goals and interests. Ensure that the data is
clean and well-structured.
 Define Your Objective: Clearly define what you want to communicate or explore with your
visualization. Are you looking to show trends, comparisons, or distributions?
 Choose the Right Visualization Type: Select a visualization type that suits your data and
objectives. Common types include bar charts, line charts, scatter plots, histograms, and pie charts.
 Prepare and Transform Data: Preprocess your data as needed. This may involve aggregating,
filtering, or transforming the data to fit the chosen visualization.
 Create the Visualization: Use a suitable tool or library to create your visualization. Customize it
with labels, colors, and other design elements.
 Interactivity (Optional): If appropriate, add interactive features to your visualization to allow users
to interact with the data.
 Test and Iterate: Review your visualization for accuracy and clarity. Seek feedback from others
and make improvements as necessary.
 Publish or Share: Once you are satisfied with your visualization, publish it on a platform, embed it
in a report, or share it with your intended audience.
 Document and Explain: Provide context and explanations for your visualization. Clearly
communicate what the viewer should take away from it.
 Maintain and Update: If the data changes or new insights emerge, update your visualization
accordingly.
2.Getting started with Tableau Software using Data file formats, connecting your Data
to Tableau, creating basic charts(line, bar charts, Tree maps),Using the Show me
panel.
 Solution :
 Getting started with Tableau software is a great way to create data visualizations quickly and
efficiently. Here are the steps to get started, including connecting your data to Tableau, creating
basic charts like line charts, bar charts, and treemaps, and using the Show Me panel:
 1. Download and Install Tableau:
 First, you'll need to download and install Tableau Desktop or Tableau Public (a free version).
Follow the installation instructions provided on the Tableau website for your specific operating
system.
 2. Prepare Your Data:
 Before connecting your data to Tableau, ensure that your data is in a suitable format. Common data
file formats that Tableau supports include Excel (.xlsx), CSV (.csv), and text files (.txt). Make sure
your data is organized with headers for each column.
 3. Connect Your Data to Tableau:
 3.1 Launch Tableau Desktop.
 3.2 Go to "File" Menu and then click on "Open".

 3.3 Choose the data source type (e.g., Excel, CSV, text file) and Select the data file(P6-
SuperStoreUS-2015.xls) and click "Open".
 3.4 Drag any table(e.g. Orders) into working area.


 3.5 Click on Worksheet(Sheet1).


 4. Data Source Pane:
 Once your data is connected, the Data Source Pane will appear on the left-hand side of the Tableau
interface. Here, you can see a preview of your data and perform data transformations or join multiple
data sources if necessary.


 5. Creating Basic Charts:
 Now, let's create some basic charts using Tableau:
 a. Line Chart:
 1. From the "Data Source pane", drag and drop the date field to the Columns shelf and a numeric
field (e.g., sales, revenue) to the Rows shelf.


 2. Then Tableau will automatically create a line chart. You can customize it by adding labels, titles,
and formatting.


 b. Bar Chart:
 1. Drag and drop a categorical field (e.g., product category, region) to the Columns shelf and
a numeric field to the Rows shelf.

 2. Then Tableau will create a bar chart. You can adjust the orientation and formatting as needed. To
display Labels on the bars click on Lables and select "Show mark lables"

 c. Treemap:
 1. Drag and drop a categorical field to the Columns shelf.
 2. Drag and drop a numeric field to the Size shelf.
 3. Tableau will create a treemap visualization. You can further customize it by adjusting colors and
labels.
 6. Using the Show Me Panel:
 The Show Me panel in Tableau helps you explore various chart types based on your data and the
fields you select. Here's how to use it:
 1. After adding fields to the Rows and Columns shelves, click on the "Show Me" panel located on
the left side of the Tableau interface.
 2. In the Show Me panel, you'll see a variety of chart options that Tableau recommends based on
your data. Click on a chart type to create it.
 3. Tableau will automatically generate the selected chart type with your data. You can further
customize it as needed.
 4. To go back to the regular worksheet view, click the "Clear" button in the Show Me panel.
3. Tableau calculations, overview of sum , avg and aggregate features, creating custom
calculations and fields

Solution:

Calculations are an essential part of creating meaningful visualizations in Tableau. Here's an overview of
sum, average (avg), and aggregate features, as well as how to create custom calculations and fields in
Tableau:

1. Sum:
oThe SUM function in Tableau is used to calculate the total sum of a numeric field or
measure. It adds up all the values in the selected field.
o To create a sum in Tableau, simply drag a numeric field or measure to the "Rows" or
"Columns" shelf, and Tableau will automatically calculate the sum.
2. Average (Avg):
o The AVG function in Tableau is used to calculate the average (mean) of a numeric field or
measure. It adds up all the values and divides by the count of values.
o To create an average in Tableau, drag a numeric field or measure to the "Rows" or
"Columns" shelf, and then right-click on the field. Choose "Measure" and select "Average."
3. Aggregate Features:

 Tableau provides various built-in aggregate functions, including SUM, AVG, COUNT, MIN,
MAX, and more.

 You can use these functions in calculated fields to perform custom aggregations or transformations
on your data.


 Creating Custom Calculations and Fields:

 Custom calculations in Tableau are created using calculated fields. These fields allow you to
perform various calculations on your data, such as combining fields, creating conditional statements,
or defining custom aggregations.
 To create a calculated field:
 a. Right-click on a blank space in the "Data" pane and select "Create Calculated Field."
 b. In the calculated field editor, you can use functions, operators, and field references to build your
calculation.
 c. Name your calculated field and click "OK" to save it.
 Examples of custom calculations:
Once you've created a calculated field, you can use it in your visualizations like any other field.
Simply drag and drop it into the appropriate shelf (Rows, Columns, Marks, etc.).
4.Applying new data calculations to your visualizations, Formatting Visualizations,
Formatting Toolsand Menus, Formatting specific parts of the view.

Solution :

Applying New Data Calculations to Visualizations

1. Drag and Drop Calculated Fields:

To apply your newly created calculated fields to a visualization, simply 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.

2. 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 calculated date range or a custom ranking.
Formatting Visualizations

Tableau provides a wide range of formatting options to make your visualizations more appealing and
informative:

1. 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. Simply select the element you want
to format and use the options in the Format pane to make changes.
5. Editing and Formatting Axes, Manipulating Data in Tableau data, Pivoting
Tableau data.

Solution :

Editing and Formatting Axes:

1. Edit Axis Title:

 Click on the axis title you want to edit.


 You can now modify the title text, font, size, color, and alignment using the Format
pane or the toolbar at the top.
2. Edit Axis Labels:

 Right-click on an axis and select "Edit Axis."


 In the Edit Axis dialog box, you can change the formatting of labels, tick marks, and other axis-
related properties.

3. Scale and Range:

 To change the scale or range of an axis, right-click on it and select "Edit Axis."
 In the dialog box, adjust the Minimum and Maximum values, scale, or range according to your
needs.
Manipulating Data in Tableau data

Change Data Type

If Tableau has inferred a wrong data type for a column, the data type can be changed by clicking on the data
type symbol in the column header
New Column(Calculated Fields)

Calculated fields can be used if you need to create customized logic for manipulating certain data types or
data values. There are a large-range of functions available in Tableau that can 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
6. Structuring your data, sorting and filtering tableau data ,pivoting tableau data.

Structuring Data:

1. Connecting to Data:
o Open Tableau and connect to your data source (Excel, CSV, database, etc.).
o Drag and drop tables or sheets onto the canvas to begin structuring your data.
2. Data Preparation:
o Cleanse and prepare your data using the Data Source tab or the Data pane in the primary
workspace.
o Perform tasks like renaming fields, changing data types, handling null values, and creating
calculated fields.

Sorting Data:

1. Sorting Data in a Visualization:


o In a worksheet, click on the drop-down arrow in the column header and choose
"Sort."
o Choose the sorting options such as ascending, descending, or manual sort.
2 .Sorting Data in the Data Source:

o In the Data Source tab, click on the sort icon next to a field to sort the data in
the source itself.

Filtering Data:

1. Applying Filters to a Visualization:


o Drag a field from the Data pane to the Filters shelf.
o Choose filter options such as range, condition, or list of values .
7. Advanced visualization tools : using filters, using detail panel, using the size panels,
customizing filters, using and customizing tooltips, formatting your data with colors

solution:

Using Filters:

1. Basic Filters:
o Apply filters to limit the data displayed on a visualization based on specific
conditions.
o Utilize range filters for numeric values or categorical filters for discrete values.

2. Interactive Filters:
o Use filter actions to create interactivity between multiple sheets or dashboards.
3. Quick Filters:

o Enable quick filters to allow users to easily interact with the data on the visualization.

4. Filter Types:
Explore different filter type s, such as relative date
filters, top N filters, and conditional filters

Using Detail and Size Panels:

1. Detail Panel:
o Drag dimensions or measures to the Detail shelf to provide more granularity in the
visualization.
o This can be especially useful for adding additional information to tooltips.
2. Size Panel:
o Drag measures to the Size shelf to control the size of data points in a visualization.

o Adjust the size en coding


to highlight important data points.
Customizing Filters:

1. Filter Types:

o Choose appropriate filter types, such as single value dropdowns, multiple value dropdowns,
or wildcard filters.

2. Filter Hierarchies:

o Create hierarchical filters for complex data structures.

3. Relative Date Filters:


o Use relative date filters to display data for a dynamic time range.

Using and Customizing Tooltips:

1. Default Tooltips:

o Tableau automatically generates tooltips based on the fields in the view.


2. Custom Tooltips:

o Customize tooltips to display specific information using calculated fields and additional text.

3. Include Images and Web Links:

o Enhance tooltips by including images or web links for additional context.


Formatting Data with Colors:

1. Color Encoding:

o Use color to encode additional information, such as categories, trends,


or outliers.
8. Creating dashboards & amp; storytelling ,creating your first dashboard and story,
design for different displays, adding interactivity to your dashboard, distributing
& publishing your visualization.

Solution:

1. Define Your Purpose:

 Identify the goal of your dashboard and the story you want to tell.
 Understand your target audience and the key insights you want them to gain.

2. Select a Visualization Tool:

 Choose a tool that suits your needs. Popular choices include Tableau, Power BI, Google Data Studio,
or programming languages like Python (with libraries such as Matplotlib, Seaborn, Plotly) or R
(using Shiny).

3. Data Preparation:

 Ensure your data is clean, organized, and ready for analysis.


 Connect your chosen tool to your data source.

4. Create Your First Dashboard:

 Start with a clear layout. Divide your dashboard into sections.


 Choose appropriate charts and graphs for your data.
 Ensure a consistent color scheme and use readable fonts.

5. Design for Different Displays:

 Optimize your dashboard for various screen sizes (desktop, tablet, mobile).
 Test the responsiveness of your design.
6. Storytelling:

 Arrange your visualizations in a logical order to tell a compelling story.


 Use annotations or text boxes to add context and explanations .
7. Adding Interactivity:

 Include filters, drop-downs, or sliders to allow users to interact with the data.
 Utilize drill-down features for detailed analysis.
 Incorporate hover-over tooltips for additional information.

8. Testing:

 Test your dashboard thoroughly to ensure data accuracy and visual appeal.
 Check interactivity and responsiveness on different devices.

9. Distributing & Publishing:

 Choose a platform for sharing. Options include cloud services (Tableau Public, Power
BI Service), embedding in a website, or exporting as a standalone file.
 Ensure your audience has access permissions if required.

10. Documentation:

 Provide documentation for users, explaining how to interact with the dashboard and
understand the insights.

11. Iterate and Update:

 Gather feedback from users and stakeholders.


 Make necessary improvements based on feedback and data changes.

12. Promote Your Visualization:

 Share your dashboard on social media, blogs, or within relevant communities.


 Encourage others to explore and share insights.

13. Maintenance:

 Regularly update your data source and make necessary adjustments to the dashboard.
 Keep an eye on performance and user feedback for ongoing improvements.
9. Tableau file Types , publishing to tableau online, sharing your
visualizations ,printing, and exporting.
Tableau File Types:

1. Tableau Workbook (.twb):


o A Tableau Workbook file contains the visualization without the actual data. It's smaller in
size compared to the packaged workbook.
o It is often used when the data source is readily available to others.
2. Tableau Packaged Workbook (.twbx):
o A packaged workbook contains both the workbook (.twb) and a copy of the data source.
o Useful for sharing workbooks along with the data, ensuring others can view the
visualization even if they don't have access to the original data source.
3. Tableau Data Source (.tds):
o A Tableau Data Source file is used to save the metadata and schema information about a
data connection, but it does not include the actual data.
o Useful for sharing the structure of a data source without revealing the underlying data.

Publishing to Tableau Online:

1. Tableau Online:
o Tableau Online is a cloud-based platform that allows you to publish, share, and collaborate
on Tableau dashboards and visualizations.
2. Publishing Workbooks:
o To publish a workbook to Tableau Online, open the workbook in Tableau Desktop, click on
"Server" in the toolbar, and select "Tableau Online." Enter your credentials and choose the
project to which you want to publish.

Sharing Visualizations:

1. Sharing Options:
o Once published, Tableau Online provides options to share visualizations publicly, with
specific users, or within a team or organization.
2. Embedding:
o You can embed Tableau visualizations in websites, blogs, or other applications, allowing
users to interact with the visualizations without accessing Tableau Online directly.

Printing:

1. Print to PDF:
o Tableau allows you to print dashboards directly or export them to PDF. In Tableau Desktop,
go to "File" and choose "Print" to print or select "Export As" to save as PDF.

Exporting:

1. Export Options:
o Tableau provides various export options, including exporting to PDF, image formats (PNG,
JPEG), Excel, CSV, and Tableau Data Extract (TDE) for sharing data.
2. Data Extracts:
o Creating a Tableau Data Extract (.hyper) allows you to save a snapshot of the data with the
workbook. This can be useful for sharing a subset of the data or ensuring data availability
offline.
10. creating custom charts, cyclical data and circular area charts, dual axis charts

solution

Creating Custom Charts:

1. Custom Shapes:
o In Tableau, you can use custom shapes to create unique chart elements. This is useful for
customizing data points based on specific categories or conditions.
o To use custom shapes, create a calculated field that assigns a shape identifier to each
data point, and then map these shapes to custom images in Tableau.
2. Background Images:
o Importing background images allows you to create custom charts over a predefined
image. This is often used for floor plans, maps, or other spatial data representations.
o Use the "Map" or "Background Images" options in Tableau to bring in custom images
and overlay data.
3. Reference Lines and Bands:
o Leverage reference lines and bands to highlight specific values or ranges in your charts.
This can be useful for emphasizing goals, benchmarks, or other significant points in
your data.

Cyclical Data and Circular Area Charts:

1. Polar Coordinates:
o When dealing with cyclical data, such as time or angles, you can use polar coordinates to
represent the information in a circular manner. Convert angles or time values into radians and
use them in polar coordinates.
2. Circular Heat Maps:
o Create circular heat maps to represent cyclical data. You can use the circular layout and color
intensity to visualize patterns over a cycle, such as hourly or monthly trends.
3. Radial Bar Charts:
o Represent data in a circular form using radial bar charts. This involves plotting bars along a
radial axis, typically starting from the center and extending outward.
Dual Axis Charts:

1. Combining Chart Types:


o Tableau allows you to combine different chart types on a single axis or use dual axes for
multiple chart types. This is useful for comparing related measures that have different scales.
2. Dual Axis Synchronization:
o Ensure synchronization between dual axes by using synchronized axes options. This helps in
aligning the data points accurately for better comparison.
3. Combo Charts:
o Create combo charts by combining, for example, a bar chart with a line chart. This is
beneficial when comparing discrete and continuous data on the same visualization.
4. Dual Axis with Different Mark Types:
o You can also use dual axes with different mark types. For instance, combining a line chart
with a circle or square chart on dual axes for a more nuanced representation.
5. Blended Axes:
o In some cases, you may want to blend axes rather than using dual axes. This involves
blending the measures on a shared axis to create a unified visualization.
Click to dual axis option

You might also like