# PyAutoPlot Functions

**Available functions:**

* `AutoPlot.`[`auto_plot`](#auto-plot)`(output_file=None, theme="light", excludes=None, **kwargs)`: Automatically generate plots based on a given dataset.
* `AutoPlot.`[`plot`](#plot)`(plot_type, x=None, y=None, **kwargs)`: Manually plot data from your dataset.
* `AutoPlot.`[`cleanup`](#cleanup)`(strategy='mean', fill_value=None, columns=None, drop_na=False)`: Perform basic data cleanup and handle missing values.
* `AutoPlot.`[`export_report`](#export-report)`(output_file, format='html')`: Export a comprehensive report of the analysis and visualizations.
* `AutoPlot.`[`export_json`](#export-json)`(output_file)`: Export statistical analysis and metadata to a JSON file.

***

### Auto plot

Automatically generate plots based on a given dataset.

```python
This method produces:
1. Detailed analysis summary as a text-based plot.
2. Numeric visualizations: Histograms, Boxplots, and Pairwise Scatter Matrix.
3. Categorical visualizations: Enhanced Bar Plots and Pie Charts.
4. Time-series visualizations: Line and Stacked Area Plots.

Parameters:
    output_file (str, optional): Base filename for saving plots. Default is None (no saving).
    theme (str, optional): Plot theme ("light", "dark", or a custom dictionary). Default is "light".
    excludes (list, optional): Sections to exclude from plotting, e.g., ["histograms"]. Default is None.
    **kwargs: Additional keyword arguments passed to plot methods.

Examples:
    autoplot.auto_plot(output_file="dataset_output", theme="dark", excludes=["pie_charts"])
```

{% hint style="info" %}
Scatter plots on large datasets can cause performance issues; use \`excludes\` to exclude them if necessary.
{% endhint %}

#### Function arguments:

`output_file`: The output file, and format (optional). E.g. `output.png` will result in a plot with the prefix `output` and the format `png`.

`theme`: Either `light` or `dark`, else defaults to `light`. You can also pass in a custom RCParam dictionary for custom themes.

`excludes`: A list of plots to exclude. Available plots are: `detailed_analysis`, `numeric`, `categorical`, `pairwise_scatter`, `pie_charts`, `line_plots`, `correlation`, `violin` and `stacked_area`.

`**kwargs`: Other supported keyword arguments for `matplotlib`. E.g. `color='orange'`.

### Plot

Manually create a plot based on data within your dataset.

```python
Parameters:
    plot_type (str): Type of plot to generate. Options include:
        - "scatter": Scatter plot (requires x and y).
        - "distribution": Histogram (requires x).
        - "boxplot": Boxplot (requires x).
        - "bar": Bar chart (requires x).
    x (str, optional): Name of the column for the x-axis or primary data. Default is None.
    y (str, optional): Name of the column for the y-axis (for scatter plots). Default is None.
    **kwargs: Additional keyword arguments for the plot.

Examples:
    autoplot.plot(plot_type="scatter", x="age", y="income")
    autoplot.plot(plot_type="distribution", x="salary", bins=20)
```

### Cleanup

Perform basic data cleanup and handle missing values.

```python
Parameters:
    strategy (str): Strategy to fill missing values ('mean', 'median', 'mode', 'constant'). Default is 'mean'.
    fill_value (any): Value to use if strategy is 'constant'.
    columns (list): List of columns to clean. If None, cleans all columns.
    drop_na (bool): If True, drops rows with missing values instead of filling them.
```

### Export Report

Export a comprehensive report of the analysis and visualizations.

```python
Parameters:
    output_file (str): Path to the output file.
    format (str): Format of the report ('html' or 'pdf'). Default is 'html'.
```

### Export JSON

Export statistical analysis and metadata to a JSON file.

```python
Parameters:
    output_file (str): Path to the output file.
```


---

# Agent Instructions: 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://infinitode-docs.gitbook.io/documentation/package-documentation/pyautoplot-package-documentation/pyautoplot-reference/pyautoplot-functions.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.
