> For the complete documentation index, see [llms.txt](https://docs.shimoku.com/dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.shimoku.com/dev/elements/charts/scatter-charts/scatter.md).

# Scatter

A scatter plot, or chart, uses dots to represent numerical values for two variables. The position of each dot on the horizontal and vertical axis indicates the values for each data point. Scatter plots are used to verify relationships between variables.

## The Method To Use <a href="#the-method-to-use" id="the-method-to-use"></a>

The method is `s.plt.scatter()`.

It must contain the following input variables:

```python
order: int 
point_fields: Union[List[Tuple[str, str]], Tuple[str, str]]
data: Union[str, DataFrame, List[Dict]]
```

Accepts the following input variables as optional:

```python
x_axis_name: Optional[str] 
y_axis_name: Optional[str]
title: Optional[str]
rows_size: Optional[int]
cols_size: Optional[int]
padding: Optional[List[int]]
show_values: Optional[List[str]]
option_modifications: Optional[Dict]
variant: Optional[str]
```

## Examples <a href="#examples" id="examples"></a>

### 1. Default Configuration <a href="#id-1.-default-configuration" id="id-1.-default-configuration"></a>

If the code runs with data, menu\_path and axes configured as this:

```python
# https://figshare.com/articles/dataset/Age_height_and_weight_raw_data/16920130
df = pd.read_csv('../data/scatter_test.csv')[
    ['AgeGroup1', 'AgeGroup2', 'AgeGroup3', 'AllGroupAge', 'WeightGroup1',
    'WeightGroup2', 'WeightGroup3', 'AllGroupWeight']
]

s.plt.scatter(
    data=df, order=0, point_fields=[
        ('AgeGroup1', 'WeightGroup1'), ('AgeGroup2', 'WeightGroup2'),
        ('AgeGroup3', 'WeightGroup3'), ('AllGroupAge', 'AllGroupWeight')],
)
```

![The scatter plot in the default configuration.](/files/DX58IPUqWZ42vr7lpsMI)

### 2.  Customization And Context  <a href="#id-2.-title-axes-names-legend-and-use-of-option_modifications" id="id-2.-title-axes-names-legend-and-use-of-option_modifications"></a>

It is possible to personalize the title of the chart, adding data points, name for each axis, the legend, size and space occupied. One example could be obtained using:

```python
# https://figshare.com/articles/dataset/Age_height_and_weight_raw_data/16920130
df = pd.read_csv('../data/scatter_test.csv')[
    ['AgeGroup1', 'AgeGroup2', 'AgeGroup3', 'AllGroupAge', 'WeightGroup1',
    'WeightGroup2', 'WeightGroup3', 'AllGroupWeight']
]

s.plt.scatter(
    data=df, order=0, point_fields=[
        ('AgeGroup1', 'WeightGroup1'), ('AgeGroup2', 'WeightGroup2'),
        ('AgeGroup3', 'WeightGroup3'), ('AllGroupAge', 'AllGroupWeight')],
    title='Age Weight correlation study',
    x_axis_name='Age',
    y_axis_name='Weight',
)
```

![Customized scatter chart](/files/WBtEqWDZDYOBvSnpmzlF)

## Variants

By setting the parameter `variant` to the following values the appearance of the chart can be changed:

{% tabs %}
{% tab title="Clean" %}

<figure><img src="/files/6okVVGZvQ87XLLl5YQS7" alt=""><figcaption><p>variant="clean"</p></figcaption></figure>
{% endtab %}

{% tab title="Minimal" %}

<figure><img src="/files/F6ZeHsOkwKV0AFnBRlcc" alt=""><figcaption><p>variant="minimal"</p></figcaption></figure>
{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.shimoku.com/dev/elements/charts/scatter-charts/scatter.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
