Skip to main content
Version: 1.0.0

Scatter Plot

Depicts the relationship between two variables using individual data points. This helps in identifying patterns, trends, and potential correlations between the variables. For example, it can be used to analyze the relationship between height and weight, or between study hours and exam scores.

Chart:


Code:

  const { muze, getDataFromSearchQuery } = viz;

  const data = getDataFromSearchQuery();

  const ColumnField = "Weight_in_lbs";
  const RowField = "Miles_per_Gallon";
  const ColorField = "Origin";
  const DetailField = "Name";

  muze
    .canvas()
    .rows([RowField])
    .columns([ColumnField])
    .detail([DetailField])
    .layers([
      {
        mark: "point",
        encoding:{
            color: ColorField,
        },
      },
    ])
    .data(data)
    .mount("#chart") // mount your chart