KEMBAR78
Mvj22isl54 Data Visualization Lab Manual | PDF | Engineering | Expert
0% found this document useful (0 votes)
19 views75 pages

Mvj22isl54 Data Visualization Lab Manual

Uploaded by

obrama59
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)
19 views75 pages

Mvj22isl54 Data Visualization Lab Manual

Uploaded by

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

(Approved by AICTE |Affiliated to VTU | Recognized by UGC with 2(f) & 12(B) status |Accredited by NBA and NAAC)

DEPARTMENT OF INFORMATION SCIENCE & ENGINEERING


ACCREDITED BY NBA

V SEMESTER
ACADEMIC YEAR 2025–2026 [ODD]
DATA VISUALIZATION LABORATORY

MVJ22ISL54
LABORATORY MANUAL

NAM E OF THE STUDENT :

BRANCH :

UNIVERSITY SEAT NO. :

SEMESTER & SECTION :

BATCH :
MVJ22ISL54-DATA VISUALIZATION LAB

Department of Information Science and Engineering

Institute Vision
To become an institute of academic excellence with international standards.
Institute Mission
 Impart quality education along with industry exposure.
 Provide world class facilities to undertake research activities relevant to
industrial and professional needs.
 Promote entrepreneurship and value added education that is socially
relevant with economic benefits

Department Vision
To be recognized as a department of repute in Information Science and Engineering by adopting
quality teaching learning process and impart knowledge to make students equipped with capabilities
required for professional, industrial and research areas to serve society.

Department Mission
 Innovation and technically competent: To impart quality education in Information Science and
Engineering by adopting modern teaching learning processes using innovation techniques that
enable them to become technically competent.
 Competitive Software Professionals: Providing training Programs that bridges gap between
industry and academia, to produce competitive software professionals.
 Personal and Professional growth: To provide scholarly environment that enables value
addition to staff and students to achieve personal and profession growth.

Program Outcomes (PO):


PO1: Engineering Knowledge: Apply knowledge of mathematics, natural science, computing,
engineering fundamentals and an engineering specialization as specified in WK1 to WK4 respectively
to develop to the solution of complex engineering problems.

PO2: Problem Analysis: Identify, formulate, review research literature and analyze complex
engineering problems reaching substantiated conclusions with consideration for sustainable
development. (WK1 to WK4)

PO3: Design/Development of Solutions: Design creative solutions for complex engineering problems and
design/develop systems/components/processes to meet identified needs with consideration for the public
health and safety, whole-life cost, net zero carbon, culture, society and environment as required. (WK5)

Dept of ISE, MVJCE Page - 2 - 2024-2025


MVJ22ISL54-DATA VISUALIZATION LAB

PO4: Conduct Investigations of Complex Problems: Conduct investigations of complex engineering


problems using research-based knowledge including design of experiments, modelling, analysis &
interpretation of data to provide valid conclusions. (WK8).

PO5: Engineering Tool Usage: Create, select and apply appropriate techniques, resources and modern
engineering & IT tools, including prediction and modelling recognizing their limitations to solve complex
engineering problems. (WK2 and WK6) PO6: The Engineer and The World: Analyze and evaluate
societal and environmental aspects while solving complex engineering problems for its impact on
sustainability with reference to economy, health, safety, legal framework, culture and environment. (WK1,
WK5, and WK7).

PO7: Ethics: Apply ethical principles and commit to professional ethics, human values, diversity and
inclusion; adhere to national & intemational laws. (WK9)

PO8: Individual and Collaborative Team work: Function effectively as an individual, and as a member
or leader in diverse/multi-disciplinary teams.

PO9: Communication: Communicate effectively and inclusively within the engineering community and
society at large, such as being able to comprehend and write effective reports and design
documentation, make effective presentations considering cultural, language, and learning differences

PO10: Project Management and Finance: Apply knowledge and understanding of engineering
management principles and economic decision-making and apply these to one's own work, as a
member and leader in a team, and to manage projects and in multidisciplinary environments.

PO11: Life-Long Learning: Recognize the need for, and have the preparation and ability for i)
independent and life-long leaming ii) adaptability to new and emerging technologies and iii) critical
thinking in the broadest context of technological change. (WK8)

Program Educational Objectives (PEOs):


 IT Proficiency: Graduates will excel as IT Experts with extensive knowledge to analyze and design
solutions to Information Engineering problems.
 Social &moral principles: Graduates will work in a team, showcase professionalism; ethical values
expose themselves to current trends and become responsible Engineers.
 Higher education: Graduates will pursue higher studies with the sound knowledge of fundamental
concepts and skills in basic sciences and IT disciplines.

Program Specific Outcomes (PSO):


PSO1. Software professional expertise: An ability to understand, analyze and develop
computer programs in the areas related to algorithms, system software, multimedia, web

Dept of ISE, MVJCE Page - 3 - 2024-2025


MVJ22ISL54-DATA VISUALIZATION LAB

design, DBMS, and networking for efficient design of computer-based systems of


varying complexity.
PSO2. Core competence: An ability to compete practically to provide solutions for real world
problems with a broad range of programming language and open source platforms in
various computing domains

Course outcomes (CO):


On the completion of this laboratory course, the students will be able to:

 Understand How to import data into Tableau


 Understand Tableau concepts of Dimensions and Measures.
 Develop Programs and understand how to map Visual Layouts and Graphical Properties
 Create a Dashboard that links multiple visualizations
 Use graphical user interfaces to create Frames for providing solutions to real world problems

Dept of ISE, MVJCE Page - 4 - 2024-2025


MVJ22ISL54-DATA VISUALIZATION LAB

DATA VISUALIZATION LABORATORY


SEMESTER – V
Laboratory Code: MVJ22ISL54 IA Marks: 50
Exam Marks: 50 Exam Hours: 03

S.no Experiment Name


1 Understanding Data, what is data, where to find data, Foundations for building
DataVisualizations, Creating Your First visualization?
Getting started with Tableau Software using Data file formats, connectingyour Data
2 to Tableau, creating basic charts (line, bar charts, Tree maps), Using the Show me
panel.
3 Tableau Calculations, Overview of SUM, AVR, and Aggregate features, Creating
custom calculations and fields.
4 Applying new data calculations to your visualizations, Formatting Visualizations,
Formatting Tools and Menus, Formatting specific parts of the view
5 Editing and Formatting Axes, Manipulating Data in Tableau data, Pivoting Tableau
data.
6 Structuring your data, Sorting and filtering Tableau data, Pivoting Tableau data
Advanced Visualization Tools: Using Filters, Using the Detail panel, using the Size
7 panels, customizing filters, Using and Customizing tooltips, Formatting your data
with colors.
Creating Dashboards & Storytelling, creating your first dashboard and Story,
8 Design fordifferent displays, adding interactivity to your Dashboard, Distributing &
Publishing your Visualization.
9 Tableau file types, publishing to Tableau Online, Sharing your visualizations,
printing, and Exporting.
10 Creating custom charts, cyclical data and circular area charts, Dual

Dept of ISE, MVJCE Page - 5 - 2024-2025


MVJ22ISL54-DATA VISUALIZATION LAB

Lab Experiments
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 includespreadsheets, 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 termsof use and legal restrictions.
• Surveys and Surveys: You can conduct your own surveys or collect data
through questionnaires and interviews.
Dept of ISE, MVJCE Page - 6 - 2024-2025
MVJ22ISL54-DATA VISUALIZATION LAB

• IoT Devices: Internet of Things (IoT) devices generate vast amounts of


data thatcan 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 strengthsand 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. Avoidcommon 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
Dept of ISE, MVJCE Page - 7 - 2024-2025
MVJ22ISL54-DATA VISUALIZATION LAB

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, connectingyour 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, includingconnecting 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:

Dept of ISE, MVJCE Page - 8 - 2024-2025


MVJ22ISL54-DATA VISUALIZATION LAB

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

3.2 Choose the data source type (e.g., Excel, CSV, text file) and Select the data
file(P6-SuperStoreUS-2015.xls) and click "Open".

3.3 Drag any table(e.g. Orders) into working area.

Dept of ISE, MVJCE Page - 9 - 2024-2025


MVJ22ISL54-DATA VISUALIZATION LAB

3.4 Click on Worksheet(Sheet1).

Dept of ISE, MVJCE Page - 10 - 2024-2025


MVJ22ISL54-DATA VISUALIZATION LAB

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.

Dept of ISE, MVJCE Page - 11 - 2024-2025


MVJ22ISL54-DATA VISUALIZATION LAB

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.

Dept of ISE, MVJCE Page - 12 - 2024-2025


MVJ22ISL54-DATA VISUALIZATION LAB

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

Dept of ISE, MVJCE Page - 13 - 2024-2025


MVJ22ISL54-DATA VISUALIZATION LAB

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"

Dept of ISE, MVJCE Page - 14 - 2024-2025


MVJ22ISL54-DATA VISUALIZATION LAB

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.

Dept of ISE, MVJCE Page - 15 - 2024-2025


MVJ22ISL54-DATA VISUALIZATION LAB

3. Tableau Calculations, Overview of SUM, AVR, and Aggregate features, Creating custom
calculations and fields.
Solution :

Tableau offers a powerful set of calculation tools that allow you to manipulate,
transform, and analyze your data in various ways. Here's an overview of some key
concepts related to Tableau calculations, including SUM, AVG (average),and
aggregate functions, as well as creating custom calculations and fields
SUM and AVG (Average) Functions

SUM Function

The SUM function in Tableau calculates the total sum of a numeric field. You can
use it to find the sum of values in a column or as part of a more complex
calculation. To use SUM, simply drag and drop a numeric field into the "SUM"
shelf, or you can create a calculated field using the SUM function.

Dept of ISE, MVJCE Page - 16 - 2024-2025


MVJ22ISL54-DATA VISUALIZATION LAB

AVG (Average) Function

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

Dept of ISE, MVJCE Page - 17 - 2024-2025


MVJ22ISL54-DATA VISUALIZATION LAB

Aggregate Functions:

Tableau provides a range of aggregate functions that allow you to perform


calculations on groups of data. Common aggregate functions include SUM, AVG,
COUNT, MIN (minimum value), and MAX (maximum value). These functions
are particularly useful when you want to analyze data at different levels of
granularity (e.g., by category, region, or time period).

Dept of ISE, MVJCE Page - 18 - 2024-2025


MVJ22ISL54-DATA VISUALIZATION LAB

Dept of ISE, MVJCE Page - 19 - 2024-2025


MVJ22ISL54-DATA VISUALIZATION LAB

Creating Custom Calculations

Tableau allows you to create custom calculations using calculated fields. Here'show
to create a custom calculation:

1. Create a New Calculated Field


In the Data Source Pane, right-click on your data source and select "Create
Calculated Field".

Dept of ISE, MVJCE Page - 20 - 2024-2025


MVJ22ISL54-DATA VISUALIZATION LAB

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


your worksheet and choosing "Create Calculated Field".

2. Enter Your Calculation:


In the calculated field editor, you can use functions, operators, and fieldreferences to
define your calculation.
For example, you can create a calculated field to calculate profit margin as(SUM([Profit])
/ SUM([Sales])) * 100.

3. Name and Save the Calculated Field:


Give your calculated field a meaningful name.
Click the "OK" or "Apply" button to save the calculated field.

Dept of ISE, MVJCE Page - 21 - 2024-2025


MVJ22ISL54-DATA VISUALIZATION LAB

4. Use the Calculated Field in Your Worksheet:


You can now use the calculated field like any other field in your worksheet. Dragit
to the Rows or Columns shelf, use it in filters, or create visualizations basedon
it.

Dept of ISE, MVJCE Page - 22 - 2024-2025


MVJ22ISL54-DATA VISUALIZATION LAB

4. Applying new data calculations to your visualizations, Formatting


Visualizations, Formatting Tools and 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, orplace
it on the Marks card to control the appearance of marks.

Dept of ISE, MVJCE Page - 23 - 2024-2025


MVJ22ISL54-DATA VISUALIZATION LAB

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.

Dept of ISE, MVJCE Page - 24 - 2024-2025


MVJ22ISL54-DATA VISUALIZATION LAB

Dept of ISE, MVJCE Page - 25 - 2024-2025


MVJ22ISL54-DATA VISUALIZATION LAB

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 usethe options
in the Format pane to make changes.

Dept of ISE, MVJCE Page - 26 - 2024-2025


MVJ22ISL54-DATA VISUALIZATION LAB

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

Dept of ISE, MVJCE Page - 27 - 2024-2025


MVJ22ISL54-DATA VISUALIZATION LAB

3. Axis and Gridlines:


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

Dept of ISE, MVJCE Page - 28 - 2024-2025


MVJ22ISL54-DATA VISUALIZATION LAB

4. Legends and Color Scales:


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

Dept of ISE, MVJCE Page - 29 - 2024-2025


MVJ22ISL54-DATA VISUALIZATION LAB

Formatting Tools and Menus

Tableau provides several formatting tools and menus to help you refine the
appearance of your visualizations:

1. Format Menu:
The Format menu at the top of the Tableau interface provides access to various
formatting options, including font styles, shading, borders, alignment, andmore.
You can use this menu to format text, labels, and other elements.

Dept of ISE, MVJCE Page - 30 - 2024-2025


MVJ22ISL54-DATA VISUALIZATION LAB

2. 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.

Dept of ISE, MVJCE Page - 31 - 2024-2025


MVJ22ISL54-DATA VISUALIZATION LAB

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

Dept of ISE, MVJCE Page - 32 - 2024-2025


MVJ22ISL54-DATA VISUALIZATION LAB

Formatting Specific Parts of the View

Tableau lets you format specific elements of your visualization:

1. Annotations:
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.

Dept of ISE, MVJCE Page - 33 - 2024-2025


MVJ22ISL54-DATA VISUALIZATION LAB

2. 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.

Dept of ISE, MVJCE Page - 34 - 2024-2025


MVJ22ISL54-DATA VISUALIZATION LAB

3. Headers and Titles:


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

Dept of ISE, MVJCE Page - 35 - 2024-2025


MVJ22ISL54-DATA VISUALIZATION LAB

Dept of ISE, MVJCE Page - 36 - 2024-2025


MVJ22ISL54-DATA VISUALIZATION LAB

Dept of ISE, MVJCE Page - 37 - 2024-2025


MVJ22ISL54-DATA VISUALIZATION LAB

Dept of ISE, MVJCE Page - 38 - 2024-2025


MVJ22ISL54-DATA VISUALIZATION LAB

5.Editing and Formatting Axes, Manipulating Data in Tableau data, Pivoting


Tableau data.
Solution :

Editing and Formatting Axes:

Dept of ISE, MVJCE Page - 39 - 2024-2025


MVJ22ISL54-DATA VISUALIZATION LAB

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
Formatpane or the toolbar at the top.

Dept of ISE, MVJCE Page - 40 - 2024-2025


MVJ22ISL54-DATA VISUALIZATION LAB

Dept of ISE, MVJCE Page - 41 - 2024-2025


MVJ22ISL54-DATA VISUALIZATION LAB

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, andother 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

Dept of ISE, MVJCE Page - 42 - 2024-2025


MVJ22ISL54-DATA VISUALIZATION LAB

Dept of ISE, MVJCE Page - 43 - 2024-2025


MVJ22ISL54-DATA VISUALIZATION LAB

Dept of ISE, MVJCE Page - 44 - 2024-2025


MVJ22ISL54-DATA VISUALIZATION LAB

Dept of ISE, MVJCE Page - 45 - 2024-2025


MVJ22ISL54-DATA VISUALIZATION LAB

Dept of ISE, MVJCE Page - 46 - 2024-2025


MVJ22ISL54-DATA VISUALIZATION LAB

Dept of ISE, MVJCE Page - 47 - 2024-2025


MVJ22ISL54-DATA VISUALIZATION LAB

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

Dept of ISE, MVJCE Page - 48 - 2024-2025


MVJ22ISL54-DATA VISUALIZATION LAB

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

Dept of ISE, MVJCE Page - 49 - 2024-2025


MVJ22ISL54-DATA VISUALIZATION LAB

Dept of ISE, MVJCE Page - 50 - 2024-2025


MVJ22ISL54-DATA VISUALIZATION LAB

Pivoting Tableau data

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

Dept of ISE, MVJCE Page - 51 - 2024-2025


MVJ22ISL54-DATA VISUALIZATION LAB

Dept of ISE, MVJCE Page - 52 - 2024-2025


MVJ22ISL54-DATA VISUALIZATION LAB

6.Structuring your data, Sorting and filtering Tableau data, Pivoting Tableau
data

AIM: To sorting, filtering and pivoting data using R package.

PROGRAM:
library(tidyverse)
fd <-
read.csv('D:/R_PRG/csv
/fruits.csv')fd %>%
arrange(desc(quantity))
%>%
filter(colour=='green') %>%
mutate(fruits=fct_reorder(fruit,
quantity)) %>%
ggplot(aes(fruits,quantity,fill=
colour))+
geom_bar(stat="identity")+
scale_y_continuous("",label=s
cales::percent)+ coord_flip()+
scale_fill_manual(values =
c("orange"="orange","green"=
"green",
"red"="red","yellow"="yellow
"))

fruits.csv
fruit, colour, quantity
apples, green,15
apples, red,25
bananas, green,10
bananas, red,40
bananas, yellow,55
oranges, orange,35
mangos, green,25
mangos, yellow,20
grapes, green,60

Dept of ISE, MVJCE Page - 53 - 2024-2025


MVJ22ISL54-DATA VISUALIZATION LAB

OUTPUT:

Result: The above experiment was successfully executed.

Dept of ISE, MVJCE Page - 54 - 2024-2025


MVJ22ISL54-DATA VISUALIZATION LAB

7.Advanced Visualization Tools: Using Filters, Using the Detail panel, using the Size
panels, customizingfilters, Using and Customizing tooltips, Formatting your data
with colors.

AIM: Customize filter and tooltips, formatting data.

PROGRAM:
library(plotly)
basket <-
read.csv("D:/R_PRG/csv/sale
s.csv")fig <- plot_ly(
type = 'scatter',
x = basket$ITEM_NAME,
y=
basket$Price
+basket$Tax,
mode =
'markers',
color =
~basket$ITEM_G
ROUP, symbol =
~basket$ITEM_G
ROUP,size = 2,
alpha = 0.5,
text = ~basket$ITEM_GROUP,
hovertemplate =
paste('<b>Price:</b>Rs.%{y:.2f}','<br><b>Ite
m:</b>%{x}','<br><b>Group:</b>%{text}'),
marker = list(size = 8,color = "yellow",line = list(color =
"red",width=1)),transforms = list(list(type = 'filter',target
= 'y',operation = '>',value = 100))
)
fig <- fig %>% layout(title = "<b>Super Market
Items > Rs.100",xaxis = list(title = "<b>Items",
color = 'Blue'),

Dept of ISE, MVJCE Page - 55 - 2024-2025


MVJ22ISL54-DATA VISUALIZATION LAB

yaxis = list(title = "<b>Price(in


Rupees)", color = 'blue'))fig

INPUT: sales.csv
ITEM_GROUP, ITEM_NAME, Price, Tax
Fruit, Apple, 200, 10
Fruit, Banana, 80, 4
Fruit, Orange, 100, 5
Fruit, Mango, 60, 3
Fruit, Papaya, 40, 2
Fruit, Lemon, 10, 1
Vegetable, Potato, 20, 1
Vegetable, Brinjal, 20, 1
Vegetable, Radish, 40, 2
Vegetable, Tomato, 40, 2
Vegetable, Onion, 40, 2
Vegetable, Cucumber, 40, 1
Dairy, Butter Milk, 10, 1
Dairy, Ghee, 200, 10
Dairy, Curd, 100, 5
Dairy, Cheese, 100, 5
Dairy, Milk, 60, 3
Dairy, Paneer, 100, 5

Dept of ISE, MVJCE Page - 56 - 2024-2025


MVJ22ISL54-DATA VISUALIZATION LAB

OUTPUT:

RESULT:
The above experiment is successfully executed and output is verified.

Dept of ISE, MVJCE Page - 57 - 2024-2025


MVJ22ISL54-DATA VISUALIZATION LAB

8. Creating Dashboards and Storytelling, creating your first dashboard and Story, Design
for different displays,adding interactivity to your Dashboard, Distributing and Publishing
your Visualization.

AIM: To create Sales Dashboard using Shiny.

PROGRAM:
library(shi
ny)
require(shi
nydashboar
d)
library(ggp
lot2)
library(dpl
yr)

df <- read.csv ('d:/R_PRG/csv/Sales_Sample.csv', stringsAsFactors =

F, header=T)header <- dashboardHeader(title = "Dashboard")

sidebar <- dashboardSidebar(sidebarMenu(menuItem("Sales Dashboard", tabName =


"dashboard", icon =icon("dashboard"))))

frow1 <- fluidRow(valueBoxOutput("value1"),valueBoxOutput("value2"))

frow2 <- fluidRow(box(title = "Revenue by Sales Rep", status = "primary", solidHeader


= TRUE,collapsible = TRUE, plotOutput("revenuebyRep", height =
"300px")),
box (title = "Regionwise Sales Data",status = "primary", solidHeader =
TRUE,collapsible = TRUE, plotOutput("revenuebyRegion", height =
"300px")))

Dept of ISE, MVJCE Page - 58 - 2024-2025


MVJ22ISL54-DATA VISUALIZATION LAB

# Combine the two fluid rows


to make the bodybody <-
dashboardBody(frow1, frow2)

#completing the ui part with dashboard Page


ui <- dashboardPage(title = 'Sales Dashboard', header, sidebar, body, skin='red')

# Create the server functions


for the dashboardserver <-
function (input, output) {

#Some data manipulation to derive the


values of KPI boxestotal.sales <-
sum(df$Sales)
total.units <- sum(df$Units_Sold)

output$value1 <- renderValueBox({ valueBox(formatC(total.sales,


format="d", big.mark=','),'Total Sales',icon =
icon("stats",lib='glyphicon'),color = "purple")})

output$value2 <- renderValueBox({ valueBox(formatC(total.units,


format="d", big.mark=','),'Total Units Sold',icon =
icon("gbp",lib='glyphicon'),color = "green")})

Dept of ISE, MVJCE Page - 59 - 2024-2025


MVJ22ISL54-DATA VISUALIZATION LAB

#creating the plot


Output content
output$revenuebyRe
p <- renderPlot({
ggplot(data = df, aes(x=QTR, y=Sales,
fill=factor(SalesRep))) +geom_bar(position =
"dodge", stat = "identity") +
ylab("Sales in Rupees") + xlab("Querter") +
theme (legend.position="bottom", plot.title = element_text(size=15,
face="bold")) +ggtitle("Revenue by Sales Rep") + labs(fill = "Sales
Rep")})

output$revenuebyRegion <- renderPlot({


ggplot(data = df, aes(x=QTR, y=Sales,
fill=factor(Region))) +geom_bar(position =
"dodge", stat = "identity") +
ylab("Sales in Rupees") + xlab("Querter") +
theme (legend.position="bottom",plot.title = element_text(size=15, face="bold")) +
ggtitle("Regionwise Revenue") + labs(fill = "Region")})
}
shinyApp(ui, server)

Dept of ISE, MVJCE Page - 60 - 2024-2025


MVJ22ISL54-DATA VISUALIZATION LAB

INPUT: Sales_Sample.csv
SalesRep, Region, QTR, Sales,
Units_Sold
Amy, North, Q1,24971,84
Amy, South, Q2,25749,557
Amy, East, Q3,24437,95
Amy, West, Q4,25355,706
Bob, North, Q1,25320,231
Bob, South, Q2,25999,84
Bob, East, Q3,22639,260
Bob, West, Q4,23949,109
Chuck, North, Q1,20280,453
Chuck, South, Q2,21584,114
Chuck, East, Q3,19625,83
Chuck, West, Q4,19832,70
Doug, North, Q1,25150,242
Doug, South, Q2,29061,146
Doug, East, Q3,27113,120
Doug, West, Q4,25953,81
John, North, Q1,34971,184
John, South, Q2,35749,657
John, East, Q3,34437,295
John, West, Q4,35355,806

Dept of ISE, MVJCE Page - 61 - 2024-2025


MVJ22ISL54-DATA VISUALIZATION LAB

OUTPUT:

RESULT: The above experiment is successfully executed and output is verified.

Dept of ISE, MVJCE Page - 62 - 2024-2025


MVJ22ISL54-DATA VISUALIZATION LAB

9. Tableau file types, publishing to Tableau Online, Sharing your visualizations, printing,
and Exporting.

AIM: To publishing, sharing, printing and exporting R output files.

PROCEDURE:

R File Types: Most commonly used files types related in R,

R-files
* .R - R Script file
* .Rproj - R Project
* .RData - R Data file

Data Files
* .csv files – CSV (comma separated values file) file
* .txt files – Text file / Tab-separated data / Tab delimited files
* .stata – stata (syllabic abbreviation of the words statistics and data) file
* .sav – SPSS (Statistical Package for the Social Sciences) data file
* .xlsx – Microsoft Excel format

Publishing to R Online and Sharing your Visualizations


Sharing your R projects on GitHub or RStudio Cloud comes with many advantages.
Collaborating with other data analysts, developers, or researchers can give you valuable
feedback and suggestions.

GitHub:
GitHub is a web-based platform that allows you to store, manage, and version control your
code and files.It is widely used by developers, researchers, and data analysts to collaborate on
projects, track changes, andhost websites.

RStudio:
RStudio Cloud is a web-based platform that allows you to create, run, and share your R
projects online. It is similar to the RStudio IDE, but you don't need to install anything on your
computer. You can access yourprojects from any browser and any device. RStudio Cloud also

Dept of ISE, MVJCE Page - 63 - 2024-2025


MVJ22ISL54-DATA VISUALIZATION LAB

lets you collaborate with others in real time,share your code and data, and publish your results
as websites or apps.

Step 1: Create Your Data Visualization


The first step in sharing your data visualization online is, of course, creating it. RStudio is a great
tool for creating data visualizations using R, and there are countless packages available for
creating everything from basic bar charts to complex interactive visualizations. Once you have
created your visualization in R, you will need to save it as an HTML file. This can be done using
the htmlwidgets package in R. Simply call the saveWidget() function with your visualization as
the first argument and the file path where you want to save the HTML file as the second
argument.

Step 2: Deploy Your Visualization to RStudio Connect


RStudio Connect is a platform for sharing R-based content, including data visualizations, with
others. To deploy your visualization to RStudio Connect, you will need to create an account on
the platform and upload your HTML file. To upload your HTML file to RStudio Connect,
simply click on the “Upload” button in the dashboard and select your file. You can then
customize the settings for your visualization, such as whocan access it and whether it should be
password-protected.

Step 3: Publish Your Visualization to GitHub Pages


GitHub Pages is a free hosting service provided by GitHub that allows you to publish your
HTML files online. To publish your visualization to GitHub Pages, you will need to create a
repository on GitHub andupload your HTML file to it. Once you have created your repository
and uploaded your HTML file, you can enable GitHub Pages by going to the repository
settings and selecting the “Pages” tab. From there, you can choose which branch you want to
publish your visualization from and customize your site settings.

Step 4: Share Your Visualization


Now that your visualization is online, you can share it with others by simply sending them the
URL. You can also embed your visualization on other websites by using the iframe code
provided by RStudio Connector GitHub Pages.

Printing & Exporting:


File formats for exporting plots:
* pdf(“rplot.pdf”): pdf file
* png(“rplot.png”): png file
* jpeg(“rplot.jpg”): jpeg file
* postscript(“rplot.ps”): postscript file
Dept of ISE, MVJCE Page - 64 - 2024-2025
MVJ22ISL54-DATA VISUALIZATION LAB

* bmp(“rplot.bmp”): bmp file


* win.metafile(“rplot.wmf”): windows metafile

If you are using RStudio you can export a plot with the Export menu of the Plots Pane:

The menu allows you to select three options: save the plot as Image, as PDF or copy the plot to
the Clipboard.
Save as image:
If you select Save as Image... the following window will open:You can select the image
format to which you want to save the plot (PNG, JPEG, TIFF, BMP, Metafile, SVG, EPS), the
width and height in pixels, the directory where is going to be saved and the file name.

Dept of ISE, MVJCE Page - 65 - 2024-2025


MVJ22ISL54-DATA VISUALIZATION LAB

Save as PDF:
If you select Save as PDF... you can select the PDF size, the orientation, the cairo
graphics API, thedirectory and the file name

Dept of ISE, MVJCE Page - 66 - 2024-2025


MVJ22ISL54-DATA VISUALIZATION LAB

Copy to clipboard:
The last option you can select is copying the image to the clipboard, as Bitmap or Metafile.
You can alsospecify the width and the height in pixels.

In R GUI you will need to go to File → Save as and select the type of file you prefer. If you
select Jpeg,you can also specify the quality of the resulting image. The last option is copying the
image to the Clipboard.

Dept of ISE, MVJCE Page - 67 - 2024-2025


MVJ22ISL54-DATA VISUALIZATION LAB

Dept of ISE, MVJCE Page - 68 - 2024-2025


MVJ22ISL54-DATA VISUALIZATION LAB

10. Creating custom charts, cyclical data and circular area charts, Dual Axis charts.

AIM: To create circular area and dual axis charts for cyclical data.

PROGRAM:
10(a) – Circular Area Chart# 10(a):
cyclical data and circular area chart
library(ggplot2)
df<-
read.csv("D:/R_PRG/csv/temp.csv
")df$Year <- as.factor(df$Year)
df$Month <- as.factor(df$Month)

p <- ggplot(df, aes(x = Month, y = Temperature, fill =


Year)) +geom_col(position = "dodge") +
ggtitle("Temperature Data [Year 2018 -
2022]") +coord_polar() +
xlab("Year and Months") + ylab("Temperature in
Celsius") +ylim(-20, 20) +
scale_fill_viridis_d()
p

p + theme(plot.title = element_text(color="brown", size=18,


face="bold.italic"),axis.title.x = element_text(color="blue", size=14,
face="bold"), axis.text.x = element_text(color="darkblue"),
axis.title.y = element_text(color="red", size=14,
face="bold"),axis.text.y =
element_text(color="darkred"))

INPUT: temp.csv
Year, Month,
Temperature
2018,JAN,4.1

Dept of ISE, MVJCE Page - 69 - 2024-2025


MVJ22ISL54-DATA VISUALIZATION LAB

2018,FEB,2.1
2018,MAR,3.8
2018,APR,8.6
2018,MAY,12.2
2018,JUN,14.6
2018,JUL,17.8
2018,AUG,16.2
2018,SEP,13
2018,OCT,10
2018,NOV,7.4
2018,DEC,5.4
2019,JAN,3.4
2019,FEB,6
2019,MAR,7
2019,APR,7.8
2019,MAY,10.3
2019,JUN,13.4
2019,JUL,17
2019,AUG,16.5
2019,SEP,13.4
2019,OCT,8.8
2019,NOV,5.6
2019,DEC,4.9
2020,JAN,5.7
2020,FEB,5.2
2020,MAR,5.8
2020,APR,9.1
2020,MAY,11.7
2020,JUN,14
2020,JUL,14.8
2020,AUG,16
2020,SEP,13
2020,OCT,9.5

Dept of ISE, MVJCE Page - 70 - 2024-2025


MVJ22ISL54-DATA VISUALIZATION LAB

2020,NOV,7.7
2020,DEC,4
2021,JAN,1.9
2021,FEB,4
2021,MAR,6.9
2021,APR,5.5
2021,MAY,9.2
2021,JUN,14.6
2021,JUL,16.9
2021,AUG,15.4
2021,SEP,15.3
2021,OCT,11.1
2021,NOV,7
2021,DEC,4.8
2022,JAN,4.3
2022,FEB,5.7
2022,MAR,6.9
2022,APR,8.2
2022,MAY,12.2
2022,JUN,14.4
2022,JUL,17.6
2022,AUG,17.2
2022,SEP,13.7
2022,OCT,11.7
2022,NOV,8
2022,DEC,2.9

OUTPUT:

Dept of ISE, MVJCE Page - 71 - 2024-2025


MVJ22ISL54-DATA VISUALIZATION LAB

PROGRAM: 10(b) – Dual Axis Chart


#Ex. No. 10(b): cyclical data and Dual Axis
Chartslibrary(latticeExtra)
df <-
read.csv("D:/R_PRG/csv/rain_temp.csv")
Year <- df$year
Rainfall <- df$rainfall
Temperature <-
df$temperature
df <- data.frame(Year, Rainfall,
Temperature)# construct separate plots
for each series
rf <- xyplot(Rainfall ~Year, df, type = c("p","l") , lwd = 2, pch
= 10,main = "Rainfall and Temperature (2010-2022)")
tp <- xyplot(Temperature ~Year, df, type = c("p","l"), lwd = 2, pch
= 10)# Make the plot with second y axis AND legend

Dept of ISE, MVJCE Page - 72 - 2024-2025


MVJ22ISL54-DATA VISUALIZATION LAB

doubleYScale(rf, tp, text = c("Rainfall (millimeters)","Temperature (Celsius)"), add.ylab2 =


TRUE)# re-plot with different styles
update(trellis.last.object(), par.settings = simpleTheme(col = c("blue","red")))

INPUT:
rain_temp.csv year,
rainfall,
temperature
2010,638.3,28.16
2011,561.7,29.85
2012,943,28.81
2013,605.5,28.85
2014,731.2,30.01
2015,715.5,29.38
2016,678.2,29.38
2017,754.5,29.71
2018,621.6,29.64
2019,805.9,29.54
2020,733.8,29.73
2021,899.8,29.4
2022,610.2,30.24

OUTPUT:

Dept of ISE, MVJCE Page - 73 - 2024-2025


MVJ22ISL54-DATA VISUALIZATION LAB

RESULT: The above experiments are successfully executed and outputs are verified.

MVJ COLLEGE OF ENGINEERING


DEPARTMENT OF INFORMATION SCIENCE AND ENGINEERING

DO'S AND DON'TS


Do's
1. Do wear ID card and follow dress code.
Dept of ISE, MVJCE Page - 74 - 2024-2025
MVJ22ISL54-DATA VISUALIZATION LAB

2. Do log off the computers when you finish.


3. Do ask the staff for assistance if you need help.
4. Do keep your voice low when speaking to others in the LAB.
5. Do ask for assistance in downloading any software.
6. Do make suggestions as to how we can improve the LAB.
7. In case of any hardware related problem, ask LAB in charge for solution.
8. if you are the last one leaving the LAB, make sure that the staff in charge of the LAB is
informed to close the LAB.
9. Be on time to LAB sessions.
10. Do Keep the LAB as clean as possible

Don'ts
1. Do not use mobile phone inside the lab.
2. Don't do anything that can make the LAB dirty (like, eating, throwing waste papers etc).
3. Do not carry any external devices without permission.
4. Don't move the chairs of the LAB.
5. Don't interchange any part of one computer with another.
6. Don't leave the computers of the LAB turned on while leaving the LAB.
7. Do not install or download any software or modify or delete any system files on any lab
computers.
8. Do not damage, remove, or disconnect any labels, parts, cables, or equipment.
9. Don't attempt to bypass the computer security system.
10. Do not read or modify other users' files.
11. If you leave the lab, do not leave your personal belongings unattended. We are not
responsible for any theft.

Dept of ISE, MVJCE Page - 75 - 2024-2025

You might also like