> ## Documentation Index
> Fetch the complete documentation index at: https://mintlify.com/gradio-app/gradio/llms.txt
> Use this file to discover all available pages before exploring further.

# BarPlot

> Create native bar chart visualizations

The BarPlot component creates interactive bar charts from pandas DataFrames using Gradio's native plotting.

## Basic usage

```python theme={null}
import gradio as gr
import pandas as pd

df = pd.DataFrame({
    "category": ["A", "B", "C"],
    "value": [10, 25, 15]
})

gr.BarPlot(
    value=df,
    x="category",
    y="value"
)
```

## Constructor

<ParamField path="value" type="pd.DataFrame | Callable | None" default="None">
  Pandas DataFrame containing the data
</ParamField>

<ParamField path="x" type="str | None" default="None">
  Column name for x-axis (can be numeric, datetime, or string)
</ParamField>

<ParamField path="y" type="str | None" default="None">
  Column name for y-axis (must be numeric)
</ParamField>

<ParamField path="color" type="str | None" default="None">
  Column name for color grouping (must be string/category)
</ParamField>

<ParamField path="title" type="str | None" default="None">
  Chart title
</ParamField>

<ParamField path="x_title" type="str | None" default="None">
  X-axis title (defaults to column name)
</ParamField>

<ParamField path="y_title" type="str | None" default="None">
  Y-axis title (defaults to column name)
</ParamField>

<ParamField path="color_map" type="dict[str, str] | None" default="None">
  Mapping of series names to colors (e.g., `{"A": "red", "B": "#00FF00"}`)
</ParamField>

<ParamField path="height" type="int | None" default="None">
  Plot height in pixels
</ParamField>

<ParamField path="y_lim" type="list[float | None]" default="None">
  Y-axis limits as `[min, max]`. Use None to auto-scale one end
</ParamField>

## Events

* **select** - Triggered when bar is selected
* **double\_click** - Triggered on double click

## Example

```python theme={null}
import gradio as gr
import pandas as pd

def create_sales_chart():
    df = pd.DataFrame({
        "Product": ["A", "B", "C", "D"],
        "Sales": [120, 250, 180, 90],
        "Region": ["North", "North", "South", "South"]
    })
    return df

with gr.Blocks() as demo:
    plot = gr.BarPlot(
        value=create_sales_chart(),
        x="Product",
        y="Sales",
        color="Region",
        title="Sales by Product",
        color_map={"North": "#FF6B6B", "South": "#4ECDC4"},
        height=400
    )
    
demo.launch()
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.