LAB Manual Updated
LAB Manual Updated
Aim: 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.
● 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.
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.
Dataset
A data set is a collection of data. In the case of tabular data, a data set corresponds to one or more database tables. where every column of a
table represents a particular variable or features , and each row corresponds to a given record or observation or sample of the data set
Dataset is collection of observation or samples or records. Each observation is consist of variables or features
1 7 72 Male
2 6.2 70 Male
3 5 48 Female
4 5.5 50 Female
5 5.8 68 Male
6 4.8 52 Female
7 6 67 Male
8 5.9 70 Male
9 4.5 40 Female
10 5.7 64 Male
In Gender Data set , S.no, Height, Weight, variables are input variables or independent variables and Gender is class Label. This dataset have Xi
and Yi.
1 Jan 6
2 Feb 4
3 March 3
4 APL 7
5 May 5
6 June 8
7 July 2
8 Aug 9
9 Sept 4
10 Oct 5
11 Nov 6
12 Dec 3
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.
● Line plot
● Bar plot
● Histogram plot
● Pie chart
● Boxplot
● Scatter plot
● Heatmap
d<-read.csv(“Dataset name”)
rain <- c(6,4,3,7,5,8,2,9,4,5,6,3)
month<-c(“Jan”,”Feb”,”March”,”Apl”,”May”,”June”,”July’,”Aug”,”Sept”,”Oct”,”Nov”,”Dec”)
print(d)
rain month
1 6 Jan
2 4 Feb
3 3 Mar
4 7 Apl
5 5 May
6 8 June
7 2 July
8 9 Aug
9 4 Sept
10 5 Oct
11 6 Nov
12 3 Dec
print(dim(d)
12 2
print(colnames)
rain month
First visualization
BAR CHART
barplot(rain, names=month, xlab="Month",ylab = "Rainfall in CM",ylim=c(0,10),col = "red", main = "Monthly rainfall 2022-2023")
WEEK-2
AIM : 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:
3.5
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:
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:
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.
4. To go back to the regular worksheet view, click the "Clear" button in the Show Me panel.
Load the Dataset into R Studio
df<-read_excel("I:\\MGIT\\Data Visualization\\sales.xlsx")
head(df)
Date Item_name Customer Sales
Bar chart
A bar chart represents data in rectangular bars with length of the bar proportional to the value of the variable. R uses the
function barplot() to create bar charts. R can draw both vertical and Horizontal bars in the bar chart. In bar chart each of the bars can
be given different colors.
Syntax : barplot (H,xlab,ylab,main, names.arg,col)
Code :
plot(sales,type = "o",col="red",xlab = "No of Sales Person",main = "Sales and Sales Person Relations",ylab="Sales in $")
Pie chart
A pie-chart is a representation of values as slices of a circle with different colors. The slices are labeled and the numbers
corresponding to each slice is also represented in the chart.
In R the pie chart is created using the pie() function which takes positive numbers as a vector input. The additional parameters are
used to control labels, color, title etc.
1. Drag and drop a categorical field (e.g., product category) to the Rows shelf.
2. Click on Numerical Field (e.g. Sales), Select Create option and Click on Calculated Field
3. After click on the calculated field, open the pop-up window, apply the Min_Aggregation function on Sales field and submit the
Apply and ok button.
4. Drag and drop a Minimu_Sale Field into worksheet.
5. After click on the calculated field, open the pop-up window , apply the Max_Aggregation function on Sales field and submit the
Apply and ok button.
6. Drag and drop a Minimu_Sale Field into worksheet.
7.After Maximum_sales drag into worksheet,
8. After click on the calculated field, open the pop-up window , apply the Avarege_Aggregation function on Sales field and submit the
Apply and ok button.
9. Drag and drop a Average_Sale Field into worksheet.
8. After click on the calculated field, open the pop-up window, apply the SUM_Aggregation function on Sales field and submit the
Apply and ok button.
9. Drag and drop a Total_Sale Field into worksheet.
10. Final output
WEEK-4
4. Applying new data calculations to your visualizations, Formatting Visualizations, Formatting Tools and Menus, Formatting specific
parts of the view.
1. Drag and drop a categorical field (e.g., product category) to columns shelf, numeral field (e.g., sales) into the Rows shelf and
create bar chart.
2.Select format option in tool menu and click font
3. After click format font option, show below figure and select SUM (sales) in Format Font.
4. Select Font style , Font size and font color.
5.Click the shading option and pick-up the color for y-axis.
6. Select Ticks color and select the number standard in number format.
7. Click the Alignment option and select the Up option
8. Select the font style , font color and size in title of y-Ais
9.Select product Category from font format
10. Select the font style ,size and color of X-Aixs
11. Select direction of text in X-Axis
12.Pick-up the color from shading
12. Click columns options from Format Lines and Select Grid Lines, color and Size
13. Click Rows options from Format Lines and Select Grid Lines, color and Size
14.Click the Format Shading and Select whorksheet color
15. Click the Alignment and keep the sales values in middle of bar chart
WEEK-6
6. Structuring your data, Sorting and filtering Tableau data, Pivoting Tableau data.
1. Drag and drop a categorical fields (e.g., product category and product sub-category) to rows shelf, numeral field (e.g., sales) into
the columns shelf and create bar chart and assign the color, label for each bar and Assign the title.
2. Drag and drop a Region filed into Filter Card and after drop, automatically open a General filter window
3. Right click on region filed in filter card and select show filter option, show the Region panel
4. pick-up some countries from Region panel
5. Drag and drop a categorical fields (e.g., product category and product sub-category) to rows shelf, numeral field (e.g., sales) into the columns
shelf and create bar chart and assign the color, label for each bar and Assign the title.
6. Drag and drop the product sub-Category field into filter card , after perform the drag and drop operation , show the filter window
and select wildcard option
7.Select Starts-with radio button from wildcard window and enter latter ‘C ‘
8. After the submit the ok button, display the items name with starting Latter ‘C’
9. Drag and Drop the sales field into rows self, product sub-category into columns self and assign the tittle, color and labels
9.Drag and drop the product sub-category into filter card and select the condition filter option from filter window.
10. Select sales from first list-box ,select sum operation option from second list-box in By field and give some condition
11. Display the corresponding output.
12. Apply the sort (ascending order) method on sales from Tool bar.
13. Apply the sort (descending order) method on sales from Tool bar.
14.Drag and Drop the sales field into rows self, product sub-category into columns self and assign the tittle, color and labels
15. Drag and drop the product sub-category into filter card and select top filter option from filter window
16. Select top option from first list-box, select 5 value from second list box.
17. After submit the apply and ok button, display the top 5 sales
18. Select Bottom option from first list-box, select 10 value from second list box.
20. After submit the apply and ok button, display the last (Bottom) 10 sales
WEEK-7
7. Advanced Visualization Tools: Using Filters, Using the Detail panel, using the Size panels, customizing filters, Using and
Customizing tooltips, formatting your data with colors
1. Drag and Drop sales and Product sub-category in row and columns silts
2. Drag and drop the profit field into tooltip marks card and after click any bar, automatically showing the profit in pop-up window
3. Drag and drop the Discount field into tooltip marks card and after click any bar, automatically showing Discount field in pop-up
window
3. Drag and drop the Order Quantity, Unit Price fields into tooltip marks card and after click any bar, automatically showing in pop-
up window
4. Drag and drop the Customer required fields into tooltip marks card and after click any whereof the line chart, automatically
showing in pop-up window
5. Drag and drop the fields into row and columns self, automatically create bar chart. And drag and drop the region field into Detail
mark card. After drop, each bar is segmented into no of regions
6. Drag and drop the sales and Region fields into Label Mark card
7. Drag and drop the sales and Segment into row and columns marks ,automatocally created the bar chart and using size markcard ,increase
the each bar width
8. Drag and drop the sales and order date fields into row and columns marks , created the Line chart and using size markcard ,increase the
each line width
9. 8. Drag and drop the sales and order date fields into row and columns marks and using size markcard ,increase the raw data(Numerical
values )size
WEEK-5
5. Editing and Formatting Axes, Manipulating Data in Tableau data, Pivoting Tableau data.
1.After creation of bar chart, right click on y-axis and select format option.
2.set the font color, size , font style and shading of y-axis
3. Right click on x-axis, select format option and set the color, font size, font style and alignment.
4.Right click on y-axis and select edit axis option
5. After select edit axis, open the new window and Edit the y-axis title.
6. Click the Reversed check box in edit axis window, automatically bar chart is showing reverse.
WEEK-9
9. Creating custom charts, cyclical data and circular area charts, Dual Axis charts.
1. Create Bar chart for Sales and line chart for Profit
2. Click the profit filed in rows shelf, open pop-up window and select Dual Axis
3. After select Dual Axis , display the dual axis worksheet.
4. Drag and Drop the sub-category, sale fields into columns and rows self’s and select shape chart from mark card
5. Region filed drag and drop into color mark card.