Implementation:Sdv dev SDV Get Column Plot
Appearance
| Knowledge Sources | |
|---|---|
| Domains | Visualization, Data_Quality |
| Last Updated | 2026-02-14 00:00 GMT |
Overview
Wrapper for SDMetrics column visualization, producing 1D marginal distribution comparison plots within SDV workflows.
Description
The get_column_plot function creates a Plotly figure comparing real and synthetic data for a single column. It auto-selects plot type based on column sdtype or accepts an explicit plot_type parameter. Both single-table and multi-table variants exist.
Usage
Call with real data, synthetic data, metadata, and a column name.
Code Reference
Source Location
- Repository: SDV
- File: sdv/evaluation/single_table.py (L64-108), sdv/evaluation/multi_table.py (L56-88)
Signature
def get_column_plot(real_data, synthetic_data, metadata, column_name, plot_type=None):
"""Get a plot comparing real and synthetic data for a column.
Args:
real_data (pd.DataFrame): Real data.
synthetic_data (pd.DataFrame): Synthetic data.
metadata (Metadata): Table metadata.
column_name (str): Column to visualize.
plot_type (str or None): 'distplot', 'bar', or None (auto-detect).
Returns:
plotly.graph_objects.Figure: Distribution comparison plot.
"""
Import
from sdv.evaluation.single_table import get_column_plot
# or for multi-table:
from sdv.evaluation.multi_table import get_column_plot
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| real_data | pd.DataFrame or dict | Yes | Real data |
| synthetic_data | pd.DataFrame or dict | Yes | Synthetic data |
| metadata | Metadata | Yes | Metadata |
| column_name | str | Yes | Column to visualize |
| plot_type | str or None | No | 'distplot', 'bar', or None (auto-detect) |
Outputs
| Name | Type | Description |
|---|---|---|
| return value | plotly.graph_objects.Figure | 1D marginal distribution comparison plot |
Usage Examples
from sdv.evaluation.single_table import get_column_plot
fig = get_column_plot(real_data, synthetic_data, metadata, column_name='age')
fig.show()
Related Pages
Implements Principle
Requires Environment
Page Connections
Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment