# Visualization

Use these functions to visualize your actual data in 1 or 2-dimensional space. This can help you see what kind of patterns the synthetic data has learned, and identify differences between the real and synthetic data.

### get\_column\_plot

Use this function to visualize a real column against the same synthetic column. You can plot any column of type: `boolean`, `categorical`, `datetime` or `numerical`.&#x20;

```python
from sdv.evaluation.single_table import get_column_plot

fig = get_column_plot(
    real_data=real_data,
    synthetic_data=synthetic_data,
    metadata=metadata,
    column_name='amenities_fee'
)
    
fig.show()
```

<figure><img src="https://1967107441-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FfNxEeZzl9uFiJ4Zf4BRZ%2Fuploads%2Flw30XrnR62mvfM4WO8ej%2FColumn%20Comparison.png?alt=media&#x26;token=d000af60-1580-4e57-9fe5-2b5ea9b135d9" alt=""><figcaption></figcaption></figure>

**Parameters**

* (required) `real_data`: A [pandas DataFrame](https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.html) object containing the table of your real data. *To skip plotting the real data, input `None`.*
* (required) `synthetic_data`: A [pandas DataFrame](https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.html) object containing the synthetic data. *To skip plotting the synthetic data, input `None`.*
* (required) `metadata`: A [Metadata](https://docs.sdv.dev/sdv/concepts/metadata) object that describes the columns
* (required) `column_name`: The name of the column you want to plot
* `plot_type`: The type of plot to create
  * (default) `None`: Determine an appropriate plot type based on your data type, as specified in the metadata.
  * `'bar'`: Plot the data as distinct bar graphs
  * `'displot'`: Plot the data as a smooth, continuous curves

**Output** A [plotly Figure](https://plotly.com/python-api-reference/generated/plotly.graph_objects.Figure.html) object that plots the distribution. This will change based on the sdtype.

{% hint style="info" %}
Use `fig.show()` to see the plot in an iPython notebook. The plot is interactive, allowing you to zoom, scroll and take screenshots.
{% endhint %}

### get\_column\_pair\_plot

Use this utility to visualize the trends between a pair of columns for real and synthetic data. You can plot any 2 columns of type: `boolean`, `categorical`, `datetime` or `numerical`. The columns do not have to the be the same type.

```python
from sdv.evaluation.single_table import get_column_pair_plot

fig = get_column_pair_plot(
    real_data=real_data,
    synthetic_data=synthetic_data,
    metadata=metadata,
    column_names=['room_rate', 'room_type'],
    )
    
fig.show()
```

**Parameters**

* (required) `real_data`: A [pandas DataFrame](https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.html) object containing the table of your real data. *To skip plotting the real data, input `None`.*
* (required) `synthetic_data`: A [pandas DataFrame](https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.html) object containing the synthetic data. *To skip plotting the synthetic data, input `None`.*
* (required) `metadata`: A [Metadata](https://docs.sdv.dev/sdv/concepts/metadata) object that describes the columns
* (required) `column_names`: A list with the names of the 2 columns you want to plot
* `plot_type`: The type of plot to create
  * (default) `None`: Determine an appropriate plot type based on your data type, as specified in the metadata.
  * `'box'`: Create a box plot showing the quartiles, broken down by different attributes
  * `'violin'`: Create a violin plot to show distributions, broken down by different attributes. This is an alternative to using `'box'`
  * `'heatmap'`: Create a side-by-side headmap showing the frequency of each pair of values
  * `'scatter'`: Create a scatter plot that plots each point on a 2D axis
* `sample_size`: The number of data points to plot
  * (default) `None`: Plot all the data points
  * `<integer>`: Subsample rows from both the real and synthetic data before plotting. Use this if you have a lot of data points.

**Output** A [plotly Figure](https://plotly.com/python-api-reference/generated/plotly.graph_objects.Figure.html) object that plots the 2D distribution. This will change based on the sdtype.

{% hint style="info" %}
Use `fig.show()` to see the plot in an iPython notebook. The plot is interactive, allowing you to zoom, scroll and take screenshots.
{% endhint %}
