This page demonstrates 2D scatter plots with marginal distributions in JSPlots.
Use the X and Y dropdowns to explore different dimension combinations. Try: mass vs height, age vs bmi, etc. Marginal distributions show on both axes.
Data: df1
Use the Color dropdown to change visual encoding. Try different combinations to highlight different aspects of the data.
Data: df2
Use the 'Facet by' dropdown to split the data. Notice: Marginal distributions appear when no faceting is selected, but disappear when a facet is applied to save space.
Data: df3
Uses Facet 1 and Facet 2 to create a grid of subplots. Default shows grade × major. Try different combinations like semester × major. Set either facet to 'None' to reduce to single facet or no faceting.
Data: df4
Demonstrates all features together: 4 dimensions for X/Y axes, multiple color options, and faceting. Explore different combinations to find interesting patterns.
Data: df5
Use date and quarter filters to focus on specific time periods. Points are colored by portfolio to show different investment trajectories.
Data: df6
This example demonstrates the difference between choices and filters: - **portfolio (choice)**: Single-select dropdown - pick exactly ONE portfolio - **quarter (filter)**: Multi-select dropdown - can select multiple quarters Use choices when the user must select exactly one option (e.g., pick one portfolio to analyze). Use filters when multiple selections make sense (e.g., view data from several quarters).
Data: df6
This scatter plot uses data from a struct containing multiple DataFrames.
The ExperimentData struct holds both measurements and metadata.
Charts reference the measurements DataFrame using Symbol("experiment.measurements").
This example shows how to use a struct as a data source. The ExperimentData struct contains measurements and metadata DataFrames. Access struct fields via dot notation.
Data: experiment.measurements
The following examples demonstrate expression_mode=true, which allows users to type
custom expressions for the X axis. This is useful for creating computed variables on-the-fly.
Available functions: z(), q(), PCA1(), PCA2(), r(), f(), c()
X axis shows z-score of returns within each sector. Try: z(:returns, [:sector, :region]) for nested groups, or just :returns for raw values.
:varname or varname+ - * /z(expr, [groups]) |
Z-score (standardize) within groups. Example: z(:returns, [:sector, :date]) |
q(expr, [groups]) |
Quantile rank (0-1) within groups. Example: q(:returns, [:sector]) |
PCA1(:v1, :v2) |
Project onto first principal component of v1 and v2 |
PCA2(:v1, :v2) |
Project onto second principal component of v1 and v2 |
r(y, x) |
OLS residual: y minus fitted value from regressing y on x |
f(y, x) |
OLS fitted value: predicted y from regressing y on x |
c(expr, min, max) |
Clamp values between min and max. Use Inf/-Inf for one-sided bounds. Example: c(:returns, -0.05, 0.05) |
:returns + :volatility
z(:returns, [:sector])
c(:vol, -Inf, 0.5)
Data: df9
X = residuals from regressing returns on market_returns (idiosyncratic returns). Try: f(:returns, :market_returns) for fitted values, or :returns - f(:returns, :market_returns).
:varname or varname+ - * /z(expr, [groups]) |
Z-score (standardize) within groups. Example: z(:returns, [:sector, :date]) |
q(expr, [groups]) |
Quantile rank (0-1) within groups. Example: q(:returns, [:sector]) |
PCA1(:v1, :v2) |
Project onto first principal component of v1 and v2 |
PCA2(:v1, :v2) |
Project onto second principal component of v1 and v2 |
r(y, x) |
OLS residual: y minus fitted value from regressing y on x |
f(y, x) |
OLS fitted value: predicted y from regressing y on x |
c(expr, min, max) |
Clamp values between min and max. Use Inf/-Inf for one-sided bounds. Example: c(:returns, -0.05, 0.05) |
:returns + :volatility
z(:returns, [:sector])
c(:vol, -Inf, 0.5)
Data: df10
X = raw_value clamped between -30 and 30 to limit outlier impact. Try: c(:raw_value, -Inf, 20) for max-only, or c(:raw_value, -20, Inf) for min-only.
:varname or varname+ - * /z(expr, [groups]) |
Z-score (standardize) within groups. Example: z(:returns, [:sector, :date]) |
q(expr, [groups]) |
Quantile rank (0-1) within groups. Example: q(:returns, [:sector]) |
PCA1(:v1, :v2) |
Project onto first principal component of v1 and v2 |
PCA2(:v1, :v2) |
Project onto second principal component of v1 and v2 |
r(y, x) |
OLS residual: y minus fitted value from regressing y on x |
f(y, x) |
OLS fitted value: predicted y from regressing y on x |
c(expr, min, max) |
Clamp values between min and max. Use Inf/-Inf for one-sided bounds. Example: c(:returns, -0.05, 0.05) |
:returns + :volatility
z(:returns, [:sector])
c(:vol, -Inf, 0.5)
Data: df11
X = z-score of clamped returns within sector. Clamp first to reduce outlier impact, then standardize. Try: c(z(:returns, [:sector]), -2, 2) to clamp z-scores instead.
:varname or varname+ - * /z(expr, [groups]) |
Z-score (standardize) within groups. Example: z(:returns, [:sector, :date]) |
q(expr, [groups]) |
Quantile rank (0-1) within groups. Example: q(:returns, [:sector]) |
PCA1(:v1, :v2) |
Project onto first principal component of v1 and v2 |
PCA2(:v1, :v2) |
Project onto second principal component of v1 and v2 |
r(y, x) |
OLS residual: y minus fitted value from regressing y on x |
f(y, x) |
OLS fitted value: predicted y from regressing y on x |
c(expr, min, max) |
Clamp values between min and max. Use Inf/-Inf for one-sided bounds. Example: c(:returns, -0.05, 0.05) |
:returns + :volatility
z(:returns, [:sector])
c(:vol, -Inf, 0.5)
Data: df9