2 - 1 Ai & Ds DV Lab
2 - 1 Ai & Ds DV Lab
II Year I Semester
Regulation: SR24
Lab Manual
1. Analyze, design, develop and implement their Artificial Intelligence and Data Science
concepts to solve real-world problems.
2. Solve social and environmental problems with ethics and perform multidisciplinary
projects with advance technologies and tools.
3. Apply cutting-edge Al tools and techniques to innovate and develop new solutions
CS308PC : Data visualization- R Programming/ Power BI LAB
Creating custom charts, cyclical data and circular area charts, Dual
10 49
Axis charts.
1: Understanding Data, What is data, where to find data, Foundations for building Data
Visualizations, Creating Your First visualization?
Understanding data involves grasping its fundamental concept and recognizing its
sources. Data refers to raw facts, figures, or information. It can be found in various places,
such as databases, spreadsheets, online repositories, and public datasets. Distinguishing
between structured and unstructured data is crucial, with structured data organized in a
predefined manner (like tables), while unstructured data lacks a predefined data model (like
text documents). Knowing where to find relevant data involves exploring databases,
governmental websites, research publications, and specialized platforms tailored to specific
fields. Developing data literacy skills enables individuals to interpret, analyze, and derive
meaningful insights from the available information.
Data visualization is the practice of translating information into a visual context, such
as a map or graph, to make data easier for the human brain to understand and pull insights
from. It is the representation of information and data through use of common graphics, such
as charts, plots, infographics, and animations. Data visualization is a powerful way for
people, especially data professionals, to display data so that it can be interpreted easily.
Data Visualization enables decision-makers of any enterprise or industry to look into
analytical reports and understand concepts that might otherwise be difficult to grasp.
Benefits of Data Visualization:
1. It is easy to understand the information with graphics
6. Minimizes ambiguity
Data visualization tools provide the ability to see and understand data trends, outliers, and
patterns in an easy, intuitive way. There are various data visualization tools available. One
must choose the tool based on various factors such as its ease of use, types of graphical
representations the tool can produce, size of the dataset the tool can handle etc. some of Data
Visualization tools are Tableau, Power BI, Google Charts, JupyteR, Grafana etc.
The following are some common types of data visualizations:
Table: A table is data displayed in rows and columns, which can be easily created in
a Word document or Excel spreadsheet.
Chart or graph: Information is presented in tabular form with data displayed along
an x and y axis, usually with bars, points, or lines, to represent data in
comparison. Geospatial visualization: Data is depicted in map form with shapes
and colours that illustrate the relationship between specific locations, such as a
choropleth or heat map.
Dashboard: Data and visualizations are displayed, usually for business purposes, to help
Tableau is a data visualization tool that provides pictorial and graphical representations of data.
It is used for data analytics and business intelligence. Tableau provides limitless data exploration
without interrupting flow of analysis. With an intuitive drag and drop interface, user 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
appears
Click the licence agreement checkbox and then click on install button. After installation, click
on Tableau Public icon to run Tableau. Following is the Tableau Public home screen.
Tableau supports connecting to a wide variety of data, stored in a variety of places. For
example, data might be stored on computer in a spread sheet or a text file, or in a big data,
relational, or cube (multidimensional) database on a server in enterprise or the data can be from
a public domain available on the web.
Data can be imported in Tableau Public from Connect panel on left side. For example, an Excel
sample data set was loaded into Tableau as follows:
After clicking on open, screen is as follows:
The data store page appears as above. The left pan shows that above dataset consists of 3
worksheets. If we drag orders table, screen appears as follows: Tableau automatically identifies
the data type of each column.
Now drag Returns table onto the Canvas to the right of Orders table. This shows the relation
between the two tables Orders and Returns.
If we click on the link between Orders and Returns table names at the top gives the summary
of 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 which improves query performance.
Bar chart:
Bar charts can be created in 3 variations in Tableau: Horizontal bars, stacked bars, side-by-side bars.
Horizontal bars can be created by selecting that type of chart from Show Me menu on right hand
side of Canvas. The type of chart in box on right hand side represents horizontal bar graph.
In similar to above, stacked bar graph can be created and the result is shown below.
Side-by-side bar chart can be created in following way.
Or the above operation can be done by creating a calculated field as shown below. To create a
calculated field, click on the down arrow button beside search tab above Tables panel, drag a
field to that calculated field window.
Then click on apply and results are shown below:
In the same way we can apply any aggregate or statistical function on data with the help of
calculated fields.
4 : Applying new data calculations to your visualizations, Formatting
Visualizations, Formatting Tools and Menus, Formatting specific parts of the view.
You can add annotations to your visualizations to highlight important points or provide
additional context. Format these annotations using the options available when you right-click on
an annotation.
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.
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.
5 : Editing and Formatting Axes, Manipulating Data in Tableau data, Pivoting Tableau data.
Tableau provides several formatting tools and menus to help you refine the appearance of your
visualizations:
Worksheet Menu:
In the Worksheet menu, you'll find options to format the entire 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.
6: Structuring your data, Sorting and filtering Tableau data, Pivoting Tableau data.
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.
There are multiple ways to sort a visualization with single click sort buttons.
In all cases, one click sorts descending, two clicks sorts ascending, and three clicks clear the
sort.
Sort from the toolbar:
If you don’t select a field before sorting, the default behavior is to sort the deepest
dimension.
In the source sheet, click the Tooltip button in the Marks card to open the Tooltip
Editor
Another way to create a filter is to drag a field directly from the Data pane to the Filters shelf.
When you add a field to the Filters shelf, the Filter dialog box opens so you can define the filter.
The Filter dialog box differs depending on whether you are filtering categorical data
(dimensions), quantitative data (measures), or date fields.
8: Creating Dashboards & Storytelling, creating your first dashboard and Story,
Design for different displays, adding interactivity to your Dashboard, Distributing
& Publishing your Visualization.
A dashboard is a way of displaying various types of visual data in one place. Usually, a
dashboard is intended to convey different, but related information in an easy-to-digest form. And
oftentimes, this includes things like key performance indicators (KPI)s or other important
business metrics that stakeholders need to see and understand at a glance.
Dashboards are useful 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, category of sales across months in a year, region is the field added. The first view
is shown below. This can be renamed at the bottom of the screen.
Now go to 2nd sheet for creating the 2nd view. The second view is shown below. A bubble chart
was drawn between profit and subcategory. Then rename the sheet.
Next 3rd view is created as follows 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.
after clicking on new dashboard option, the screen is shown below.
Now the sheets or views which are created earlier can be drag and dropped on this dashboard.
The above three created views are placed in the dashboard as follows. One can follow their own
way of importing sheets on the dashboard. After creating dahsboard, title can be given to the
dashboard from Dashboard tab. Dahsboard can be customized in terms of its appearance by the
user if requied. Dashboard once created can be saved on users system and can be retrieved
whenever required.
9: Tableau file types, publishing to Tableau Online, Sharing your visualizations,
printing, and Exporting.
You can save your work using several different Tableau specific file types: workbooks,
bookmarks, packaged data files, data extracts, and data connection files. Each of these file types
are described below. For related details, see Save Your Work.
Workbooks (.twb) – Tableau workbook files have the .twb file extension. Workbooks
hold one or more worksheets, plus zero or more dashboards and stories.
Bookmarks (.tbm) – Tableau bookmark files have the .tbm file extension. Bookmarks
contain a single worksheet and are an easy way to quickly share your work. For more
information, see Save a bookmark(Link opens in a new window).
Packaged Workbooks (.twbx) – Tableau packaged workbooks have the .twbx file
extension. A packaged workbook is a single zip file that contains a workbook along
with any supporting local file data and background images. This format is the best way
to
package your work for sharing with others who don’t have access to the original data. For
more information, see Packaged Workbooks.
Extract (.hyper) – Tableau extract files have the .hyper extension. Extract files are a local
copy of a subset or entire data set that you can use to share data with others, when you
need to work offline, and improve performance. For more information, see Extract Your
Data.
Data Source (.tds) – Tableau data source files have the .tds file extension. Data source
files are shortcuts for quickly connecting to the original data that you use often. Data
source files do not contain the actual data but rather the information necessary to
connect to the actual data as well as any modifications you've made on top of the actual
data such as changing default properties, creating calculated fields, adding groups, and
so on. For more information, see Save Data Sources.
Packaged Data Source (.tdsx) – Tableau packaged data source files have the .tdsx file
extension. A packaged data source is a zip file that contains the data source file (.tds)
described above as well as any local file data such as extract files (.hyper), text files,
Excel files, Access files, and local cube files. Use this format to create a single file
that you can then share with others who may not have access to the original data
stored locally on your computer. For more information, see Save Data Sources.
These files can be saved in the associated folders in the My Tableau Repository directory, which
is automatically created in your My Documents folder when you install Tableau. Your work
files can also be saved in other locations, such as your desktop or a network directory.
You can specify a new location for the Tableau repository if you are not using the default
location in your Documents folder. For instance, if you are required to have your data on a
network server instead of on your local machine, you can point Tableau at the remote repository.
1. Select File > Repository Location.
2. Select a new folder that will act as the new repository location in the Select a
Repository dialog box.
Changing the repository location does not move the files contained in the original
repository. Instead, Tableau creates a new repository where you can store your files.
You want to share a workbook with your colleagues, you can publish it to Tableau Server or
Tableau Cloud with a few simple clicks. There, other people can view it, interact with it,
and even edit it if their server permissions allow.
Before you publish your workbook, make sure you know the following:
The name of the server and how you sign in to it. If your organization uses Tableau
Cloud, you can click the Quick Connect link.
Any publishing guidelines your Tableau administrator might have, such as the name of
the project you should publish to.
1. With the workbook open in Tableau Desktop, click the Share button in the toolbar.
If you aren’t already signed in to Tableau Server or Tableau Cloud, do so now. If you
don’t have a site yet, you can create one on Tableau Cloud.
2. In the Publish Workbook dialog box, select the project to publish to.
3. Name the workbook according to whether you’re creating a new one or publishing
over an existing one.
4. Under Data Sources, select Edit. For Authentication, select Allow refresh
access or Embed password.
For some data connections, only one authentication option appears. If None shows, leave
it set to that.
5. Click Publish.
If this is your first time publishing a workbook, test it on the server and work out any
glitches before letting other users know the workbook is available.
1. Make sure your colleagues can access the site and project you published to.
3. After they sign in, the workbook opens for viewing, interacting, or editing.
10: Creating custom charts, cyclical data and circular area charts, Dual Axis charts.
Creating custom charts:
Bump charts are very useful for comparative analysis and in understanding trends over a period
of time. In this blog let’s learn the steps to build a bump chart, with an example scenario –
comparing sales trends in different regions across months of 2017.
1. Build the following chart:
4. Duplicate the ‘SUM(Sales)’ pill and place it beside the original pill in Rows and
create a dual axis:
5. Convert ‘Marks’ of one of the Measure Axis to ‘Circle’ and add the ‘Rank of
SUM(Sales)’ as the ‘Text’ for the Labels. Change the ‘Alignment’ of the labels’ text as shown
below and hide the axis on the right side of the chart:
6. Finally, edit the axis and reverse the scale. Right click on the axis and select the option
to bring the marks to the front. We get the final output as shown below:
Dual Axis charts:
A dual axis chart is used to present the relationship between two variables. More specifically,
these charts are useful for demonstrating the relationship between two or more measures with
different amplitude and scale. The dual axis charts help in presenting plenty of information in the
limited space present on your dashboard and also allows you to understand the trends, you may
have missed otherwise.
For example, in our US Super Store dataset, we have the Profit and Sales measures. These two
measures have different magnitude and scale. Let’s directly dive into the implementation in a
stepwise manner.
Here, for our visualization, we are going to use three attributes Sub-Category from the
dimensions and two measures i.e. Profit and Sales.
Open a new worksheet and add the Sub-category from the dimension pane to the Columns shelf.
Now pick Sales from the Measures pane and drop in the Row shelf below the Sub-Category.
Similarly, Select Profit measure and drop next to the Sales in Row shelf. After this step, your
visualization will look as shown in the image below.
Here we have two charts present on multiple axes. The next step is to convert these two different
charts into a dual axis chart. For this click on the triangle present on the profit pill in the rows
shelf.
Hereafter, you will have a drop-down menu just select the Dual axis option from that.
Once you select the Dual axis boom! your visualization changes completely. Like this
Although you have a dual axis visualization, they are on different scales. Now there is a need to
bring both measures on the same scale using synchronize axis. For this right-click on any axis
Profit or Sales and select synchronize axis from the menu. As shown in the following image.
Here is the result you have your Dual axis chart with synchronized axes.
To make it more interesting you can further play around with it. Like changing the shape of
Sales from Automatic to bar in the markets card or changing the respective colors, adding
borders.
Similarly, you can go to Profit and change its shape to a line. Your final
visualization will look like this. Interesting right!