0% found this document useful (0 votes)
81 views

Create A Scatterplot

A scatter plot is a chart that displays the relationship between two variables through the use of Cartesian coordinates. Data points representing each variable are plotted on the x and y axes to visualize if the variables are positively or negatively correlated or if no correlation exists. The document provides steps for creating a scatter plot in Excel, including selecting the relevant data, choosing a scatter plot type from the insert menu, and customizing elements like titles, labels, and styles.

Uploaded by

rithikashivani06
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
81 views

Create A Scatterplot

A scatter plot is a chart that displays the relationship between two variables through the use of Cartesian coordinates. Data points representing each variable are plotted on the x and y axes to visualize if the variables are positively or negatively correlated or if no correlation exists. The document provides steps for creating a scatter plot in Excel, including selecting the relevant data, choosing a scatter plot type from the insert menu, and customizing elements like titles, labels, and styles.

Uploaded by

rithikashivani06
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 15

CREATE A SCATTERPLOT

ABSTRACT:

A scatter plot is a chart type that is normally used to observe and visually display the relationship between
variables. The values of the variables are represented by dots. The positioning of the dots on the vertical
and horizontal axis will inform the value of the respective data point; hence, scatter plots make use of
Cartesian coordinates to display the values of the variables in a data set. Scatter plots are also known as
scattergrams, scatter graphs, or scatter charts.

 A scatter plot is a chart type that is normally used to observe and visually display the relationship between
variables. It is also known as a scattergram, scatter graph, or scatter chart.
 The data points or dots, which appear on a scatter plot, represent the individual values of each of the data
points and also allow pattern identification when looking at the data holistically.
 The most common use of the scatter plot is to display the relationship between two variables and observe
the nature of such a relationship. The relationships observed can either be positive or negative, non-linear
or linear, and/or, strong or weak.
Based on the pattern of the data points, you can determine the correlation between the two variables –

 Positive Correlation – In a positive correlation, as one variable increases, the other variable also
tends to increase. Similarly, as one variable decreases, the other variable tends to decrease. In this
scenario, the points form an upward-sloping line.
 Negative Correlation – In a negative correlation, as one variable increases, the other variable also
tends to decrease. Similarly, as one variable decreases, the other variable tends to increase. In this
scenario, the points form a downward-sloping line.
 No Correlation – In the case of no correlation, there is no apparent relationship between the two
variables. Changes in one variable do not predict changes in the other variable. The data points on
the plot are scattered without forming a clear pattern or trend.
EXISTING SYSTEM:

Let’s walk through the steps to make a scatter plot.

Step 1: Organize your data

Ensure that your data is in the correct format. Since scatter graphs are meant to show how two numeric
values are related to each other, they should both be displayed in two separate columns.

The first column will usually be plotted on the X-axis and the second column on the Y-axis. The
independent variable usually falls on the X-axis and the dependent variable on the Y-axis.

Step 2: Select the relevant data

Highlight the columns containing both sets of variables. If the columns are non-contiguous, hold down
the Ctrl key between selections. Only select the columns with the two sets of data that are being examined
for a cause/effect relationship.

Step 3: Select the desired type of scatter plot

From the Insert tab, go to the Charts group and click the Scatter graph symbol.

Types of scatter plots

Several types of scatter plots are available from the Insert Charts menu. These include:

 ‘Classic’ scatter chart (solely with data points)


 Scatter with smooth lines and markers
 Scatter with smooth lines
 Scatter with straight lines and markers
 Scatter with straight lines
 Scatter charts with lines are best used when you have few data points. Otherwise, the plot area can begin
to look quite cluttered.

In Excel, a scatter chart displays data points positioned at coordinates located on an x-axis and y-axis.
Scatter charts are sometimes called X and Y charts, scatter plots, scatter diagrams, or scatter graphs.
A scatter chart helps you compare pairs of values and understand the relationship between two variables.
To create a scatter plot in Excel on laptop or desktop systems, follow these steps.

 Check your data set to make sure you have at least two columns (or rows) of data. Ideally, the first cell in
each sequence will contain a text entry that describes the numbers that follow, such as “Mileage of Car” or
“Annual Maintenance Expense”.
 With your mouse, select the cell in the upper left of the data you want to chart, then drag the cursor to the
lower right cell of the data set to select it.
 Select Insert.
 In Charts, select the Scatter (X, Y) or Bubble Chart dropdown.
 Select More Scatter Charts at the bottom of the menu.
 Select the Scatter chart option you prefer. (Scatter, Scatter with Smooth Lines and Markers, Scatter with
Smooth Lines, Scatter with Straight Lines and Markers, Scatter with Straight Lines, Bubble, or 3-D
Bubble)
 Select whether you want to compare the two columns of data, or use the two columns as x- and y-axis
indicators, respectively. Select the chart style, then select OK.
 Excel should now have inserted a chart into your spreadsheet that displays your data. If your chart title,
axis labels, and other chart elements meet your needs, you may stop at this point. However, in most cases,
you’ll need to adjust one or more chart elements.
 Click (or tap) on blank space in the chart to select the chart.
 Next, adjust chart element display options. Select the + key next to the chart to choose which chart
elements display. Next to each element, if you select the checkbox, the item will display. Deselect the
checkbox to hide an element.
The chart elements may include Axes, Axis Titles, Chart Title, Data Labels, Error Bars, Gridlines,
Legend, and Trendline. Select to the right of an element name to see a triangle that allows access to
additional element options. For example, next to Gridlines, you may enable Primary Major Horizontal,
Primary Major Vertical, Primary Minor Horizontal, Primary Minor Vertical, or More Options.

PROJECT DESCRIPTION:

With the source data correctly organized, making a scatter plot in Excel takes these two quick steps:
 Select two columns with numeric data, including the column headers. In our case, it is the range
C1:D13. Do not select any other columns to avoid confusing Excel.
 Go to the Inset tab > Chats group, click the Scatter chart icon, and select the desired template. To
insert a classic scatter graph, click the first thumbnail:

The scatter diagram will be immediately inserted in your worksheet:


Basically, you may consider the work done. Or, you can customize some elements of your graph to make
it look more beautiful and to convey the correlation between the two variables clearer.
Scatter chart types

Besides the classic scatter plot shown in the above example, a few more templates are available:

 Scatter with smooth lines and markers


 Scatter with smooth lines
 Scatter with straight lines and markers
 Scatter with straight lines
Scatter with lines is best to be used when you have few data points. For example, here's how you can
represent the data for the first four months by using the scatter graph with smooth lines and markers:

The Excel XY plot templates can also draw each variable separately, presenting the same relationships in
a different way. For this, you should select 3 columns with data - the leftmost column with text values
(labels), and the two columns with numbers.

In our example, the blue dots represent advertising cost, and orange dots represent the items sold:

To view all available scatter types in one place, select your data, click the Scatter (X, Y) icon on the
ribbon, and then click More Scatter Charts… This will open the Inset Chart dialog box with the XY
(Scatter) type selected, and you switch between the different templates at the top to see which one
provides the best graphic representation of your data:
MODULES:

1.

# import xlsxwriter module

import xlsxwriter

# Workbook() takes one, non-optional, argument

# which is the filename that we want to create.

workbook = xlsxwriter.Workbook('chart_scatter.xlsx')

# The workbook object is then used to add new


# worksheet via the add_worksheet() method.

worksheet = workbook.add_worksheet()

# Create a new Format object to formats cells

# in worksheets using add_format() method .

# here we create bold format object .

bold = workbook.add_format({'bold': 1})

# create a data list .

headings = ['Number', 'Batch 1', 'Batch 2']

data = [

[2, 3, 4, 5, 6, 7],

[80, 80, 100, 60, 50, 100],

[60, 50, 60, 20, 10, 20],

# Write a row of data starting from 'A1'

# with bold format .

worksheet.write_row('A1', headings, bold)

# Write a column of data starting from

# 'A2', 'B2', 'C2' respectively .


worksheet.write_column('A2', data[0])

worksheet.write_column('B2', data[1])

worksheet.write_column('C2', data[2])

# Create a chart object that can be added

# to a worksheet using add_chart() method.

# here we create a scatter chart object .

chart1 = workbook.add_chart({'type': 'scatter'})

# Add a data series to a chart

# using add_series method.

# Configure the first series.

# = Sheet1 !$A$1 is equivalent to ['Sheet1', 0, 0].

# note : spaces is not inserted in b / w

# = and Sheet1, Sheet1 and !

# if space is inserted it throws warning.

chart1.add_series({

'name': '= Sheet1 !$B$1',

'categories': '= Sheet1 !$A$2:$A$7',

'values': '= Sheet1 !$B$2:$B$7',

})
# Configure a second series.

# Note use of alternative syntax to define ranges.

# [sheetname, first_row, first_col, last_row, last_col].

chart1.add_series({

'name': ['Sheet1', 0, 2],

'categories': ['Sheet1', 1, 0, 6, 0],

'values': ['Sheet1', 1, 2, 6, 2],

})

# Add a chart title

chart1.set_title ({'name': 'Results of data analysis'})

# Add x-axis label

chart1.set_x_axis({'name': 'Test number'})

# Add y-axis label

chart1.set_y_axis({'name': 'Data length (mm)'})

# Set an Excel chart style.

chart1.set_style(11)

# add chart to the worksheet

# the top-left corner of a chart

# is anchored to cell E2 .
worksheet.insert_chart('E2', chart1)

# Finally, close the Excel file

# via the close() method.

workbook.close()

2.

# import xlsxwriter module

import xlsxwriter

# Workbook() takes one, non-optional, argument

# which is the filename that we want to create.

workbook = xlsxwriter.Workbook('chart_scatter2.xlsx')

# The workbook object is then used to add new

# worksheet via the add_worksheet() method.

worksheet = workbook.add_worksheet()

# Create a new Format object to formats cells

# in worksheets using add_format() method .

# here we create bold format object .

bold = workbook.add_format({'bold': 1})

# create a data list .


headings = ['Number', 'Batch 1', 'Batch 2']

data = [

[2, 3, 4, 5, 6, 7],

[80, 80, 100, 60, 50, 100],

[60, 50, 60, 20, 10, 20],

# Write a row of data starting from 'A1'

# with bold format .

worksheet.write_row('A1', headings, bold)

# Write a column of data starting from

# 'A2', 'B2', 'C2' respectively .

worksheet.write_column('A2', data[0])

worksheet.write_column('B2', data[1])

worksheet.write_column('C2', data[2])

# Create a chart object that can be added

# to a worksheet using add_chart() method.

# here we create a Scatter chart sub-type with

# straight lines and markers object .

chart1 = workbook.add_chart({'type': 'scatter', 'subtype': 'straight_with_markers'})


# Add a data series to a chart

# using add_series method.

# Configure the first series.

# = Sheet1 !$A$1 is equivalent to ['Sheet1', 0, 0].

chart1.add_series({

'name': '= Sheet1 !$B$1',

'categories': '= Sheet1 !$A$2:$A$7',

'values': '= Sheet1 !$B$2:$B$7',

})

# Configure a second series.

# Note use of alternative syntax to define ranges.

# [sheetname, first_row, first_col, last_row, last_col].

chart1.add_series({

'name': ['Sheet1', 0, 2],

'categories': ['Sheet1', 1, 0, 6, 0],

'values': ['Sheet1', 1, 2, 6, 2],

})

# Add a chart title

chart1.set_title ({'name': 'Results of data analysis'})


# Add x-axis label

chart1.set_x_axis({'name': 'Test number'})

# Add y-axis label

chart1.set_y_axis({'name': 'Data length (mm)'})

# Set an Excel chart style.

chart1.set_style(11)

# add chart to the worksheet

# the top-left corner of a chart

# is anchored to cell E2 .

worksheet.insert_chart('E2', chart1)

# Finally, close the Excel file

# via the close() method.

workbook.close()
MODULES SCREENSHOTS:
CONCLUSION:

A scatter plot can also be useful for identifying other patterns in data. We can divide data points into
groups based on how closely sets of points cluster together. Scatter plots can also show if there are any
unexpected gaps in the data and if there are any outlier points. This can be useful if we want to segment
the data into different parts, like in the development of user personas.

A scatterplot is one of the most powerful yet simple visual plots available. In a scatterplot, the data points
are marked in Cartesian space with attributes of the dataset aligned with the coordinates. The attributes
are usually of continuous data type. One of the key observations that can be concluded from a scatterplot
is the existence of a relationship between two attributes under inquiry. If the attributes are linearly
correlated, then the data points align closer to an imaginary straight line; if they are not correlated, the
data points are scattered. Apart from basic correlation, scatterplots can also indicate the existence of
patterns or groups of clusters in the data and identify outliers in the data. This is particularly useful for
low-dimensional datasets.

REFERENCES:

https://www.google.com/url?
sa=t&rct=j&q=&esrc=s&source=web&cd=&cad=rja&uact=8&ved=2ahUKEwiKnY3x9deEAxUMcGwG
HXcoAQAQFnoECBYQAw&url=https%3A%2F%2F2.zoppoz.workers.dev%3A443%2Fhttps%2Fwww.ablebits.com%2Foffice-addins-blog
%2Fmake-scatter-plot-excel%2F&usg=AOvVaw03iQW7NT9DHWgRauAcrL6u&opi=89978449

https://www.google.com/url?
sa=t&rct=j&q=&esrc=s&source=web&cd=&cad=rja&uact=8&ved=2ahUKEwiKnY3x9deEAxUMcGwG
HXcoAQAQFnoECCwQAQ&url=https%3A%2F%2F2.zoppoz.workers.dev%3A443%2Fhttps%2Ftrumpexcel.com%2Fscatter-plot-excel
%2F&usg=AOvVaw29gCB-FgfYNszG4RNxScUJ&opi=89978449

https://www.geeksforgeeks.org/python-plotting-scatter-charts-in-excel-sheet-using-xlsxwriter-module/

You might also like