See here for the example code that generated this page
ScatterSurface3D Examples
This page demonstrates 3D scatter plots with fitted surfaces in JSPlots.
Example 1: Basic 3D Scatter with Fitted Surfaces
This example shows 3D scatter points with automatically fitted surfaces using kernel smoothing.
Features:
- Three groups: Each group has different underlying patterns (saddle, paraboloid, plane)
- Default smoothing: Each group uses its optimal smoothing parameter
- Interactive controls: Toggle surfaces/points, adjust X/Y ranges, select smoothing levels
- Color coding: Each group has a distinct color for both points and surface
3D Scatter with Auto-Fitted Surfaces
Use controls to toggle display and adjust smoothing. Default smoothing varies by group.
Groups (click to toggle visibility)
Surface Controls
Defaults
Example 2: Custom Surface Fitting Function
This example demonstrates using a custom surface fitting function.
The custom fitter uses a simple moving average approach with adjustable bandwidth.
- Custom smoother: User-defined function for fitting surfaces
- Multiple smoothing levels: Pre-compute surfaces at different smoothing parameters
- Dropdown control: Switch between smoothing levels or use group-specific defaults
Custom Surface Fitter Example
Custom smoothing function with adjustable bandwidth parameter
Groups (click to toggle visibility)
Surface Controls
Defaults
Example 3: Financial Data with Multiple Grouping Schemes
This example demonstrates stock returns analysis with switchable grouping schemes.
Dataset: 150 synthetic stocks with financial metrics
- X-axis (Carry): Interest rate differential - higher carry suggests positive yield
- Y-axis (Trading Activity): Recent market volatility and volume
- Z-axis (24h Return): Expected stock return over next 24 hours (%)
Grouping Schemes: Use the dropdown to switch between different groupings:
- Industry: Group by GICS sector (Technology, Financials, Healthcare, Energy, Consumer, Industrials)
- Country: Group by geographic region (USA, UK, Germany, Japan, China)
Key Insights:
- Each grouping reveals different patterns in the data
- Technology and Healthcare sectors tend to show higher returns
- Different countries have different return profiles based on local market conditions
- The L1/L2 toggle allows switching between robust (median) and smooth (mean) fits
Stock Returns - Switchable Grouping
Use the grouping scheme dropdown to switch between Industry and Country groupings. Colors and surfaces update automatically.
Groups (click to toggle visibility)
Surface Controls
Defaults
Summary
ScatterSurface3D combines 3D scatter plots with fitted surfaces:
Key Features
- Fitted Surfaces: Automatically fit smooth surfaces to point clouds
- Multiple Smoothing Levels: Pre-compute surfaces at different smoothing parameters
- Group-Specific Defaults: Each group can have its own optimal smoothing parameter
- Interactive Controls:
- Toggle all surfaces on/off
- Toggle all points on/off
- Toggle individual groups by clicking color buttons
- Select smoothing parameter or use group defaults
- Customizable: Provide your own surface fitting function
Use Cases
- Visualizing complex 3D relationships in data
- Comparing fitted surfaces across different groups
- Exploring optimal smoothing parameters interactively
- Non-parametric regression visualization
Controls Guide:
- Smoothing dropdown: Select "Defaults" to use group-specific smoothing, or choose a specific value to apply to all groups
- Color buttons: Click to toggle visibility of that group's points and surface
- X/Y Range: Filter data to focus on specific regions