Skip to content

Scatter3d

Overview

The scatter3d insight type is used to create 3D scatter plots, which visualize data points based on three numerical variables (x, y, and z axes). 3D scatter plots are useful for exploring relationships between three variables and detecting patterns or outliers in higher-dimensional data.

You can customize the marker size, color, and add lines to connect points in 3D space to represent the data effectively.

Common Uses

  • 3D Relationship Analysis: Exploring the relationship between three numerical variables.
  • Pattern Detection: Identifying trends and clusters in three dimensions.
  • High-Dimensional Data: Visualizing higher-dimensional datasets.

Check out the Attributes for the full set of configuration options

Examples

Common Configurations

Here's a simple scatter3d insight showing data points in 3D space:

sources:
  - name: scatter3d-data-source
    type: duckdb
    database: target/seeds/scatter3d_data.duckdb
    seeds:
      - table_name: model
        args:
          - echo
          - |
            x,y,z
            1,10,15
            2,20,25
            3,15,30
            4,25,35
            5,30,40

models:
  - name: scatter3d-data
    source: ${ref(scatter3d-data-source)}
    sql: select * from model
insights:
  - name: Simple Scatter3D Plot
    props:
      type: scatter3d
      mode: "markers"

charts:
  - name: Simple Scatter3D Chart
    insights:
      - ${ref(Simple Scatter3D Plot)}
    layout:
      title:
        text: Simple Scatter3D Plot<br><sub>3D Data Points</sub>

This example demonstrates a scatter3d insight with lines connecting the data points in 3D space:

sources:
  - name: scatter3d-data-lines-source
    type: duckdb
    database: target/seeds/scatter3d_data_lines.duckdb
    seeds:
      - table_name: model
        args:
          - echo
          - |
            x,y,z
            1,5,7
            2,10,12
            3,8,10
            4,15,18
            5,12,17

models:
  - name: scatter3d-data-lines
    source: ${ref(scatter3d-data-lines-source)}
    sql: select * from model
insights:
  - name: Scatter3D Plot with Lines
    props:
      type: scatter3d
      mode: "lines+markers"

charts:
  - name: Scatter3D Chart with Lines
    insights:
      - ${ref(Scatter3D Plot with Lines)}
    layout:
      title:
        text: Scatter3D Plot with Lines<br><sub>Connecting Data Points with Lines</sub>

Here's a scatter3d insight with custom marker sizes and colors, giving more visual weight to each data point in 3D space:

sources:
  - name: scatter3d-data-custom-source
    type: duckdb
    database: target/seeds/scatter3d_data_custom.duckdb
    seeds:
      - table_name: model
        args:
          - echo
          - |
            x,y,z,size,color
            1,5,10,15,#1f77b4
            2,10,12,20,#ff7f0e
            3,8,10,25,#2ca02c
            4,15,18,30,#d62728
            5,12,20,35,#9467bd

models:
  - name: scatter3d-data-custom
    source: ${ref(scatter3d-data-custom-source)}
    sql: select * from model
insights:
  - name: Scatter3D Plot with Custom Markers
    props:
      type: scatter3d
      mode: "markers"
      marker:
        size: ?{${ref(scatter3d-data-custom).size}}
        color: ?{${ref(scatter3d-data-custom).color}}

charts:
  - name: Scatter3D Chart with Custom Markers
    insights:
      - ${ref(Scatter3D Plot with Custom Markers)}
    layout:
      title:
        text: Scatter3D Plot with Custom Markers<br><sub>Custom Sizes and Colors for 3D Data Points</sub>