Skip to main content

Basic Scatterplot

Reveals the relationship between two variables by plotting data points on a grid. The position of each point on the grid represents its values for the two variables. This helps in identifying patterns, trends, and potential correlations between the variables. For example, it can be used to investigate the relationship between income and education level, or between advertising spending and sales.

Chart:


Code:

  muze
.canvas()
.columns(["Weight_in_lbs"])
.rows(["Miles_per_Gallon"])
.detail(["Name"])
.data(rootData)
.layers([
{
mark: "point",
outline: true,
encoding: {
color: "Origin",
opacity: {
value: () => 1,
},
},
},
])