> ## 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.

# Plot

> Display interactive plots from various plotting libraries

The Plot component displays plots from matplotlib, plotly, altair, or bokeh.

## Basic usage

```python theme={null}
import gradio as gr
import matplotlib.pyplot as plt

def create_plot():
    fig, ax = plt.subplots()
    ax.plot([1, 2, 3, 4], [1, 4, 2, 3])
    return fig

gr.Interface(
    fn=create_plot,
    inputs=gr.Button("Generate"),
    outputs=gr.Plot()
).launch()
```

## Constructor

<ParamField path="value" type="Any | None" default="None">
  Default plot object (matplotlib, plotly, altair, or bokeh figure)
</ParamField>

<ParamField path="format" type="str" default="'webp'">
  File format for matplotlib plots (e.g., "png", "jpg")
</ParamField>

<ParamField path="label" type="str | None" default="None">
  Label displayed above component
</ParamField>

## Events

* **change** - Triggered when plot changes

## Examples

### Matplotlib

```python theme={null}
import gradio as gr
import matplotlib.pyplot as plt
import numpy as np

def plot_sine():
    x = np.linspace(0, 2*np.pi, 100)
    y = np.sin(x)
    
    fig, ax = plt.subplots()
    ax.plot(x, y)
    ax.set_title("Sine Wave")
    return fig

gr.Interface(fn=plot_sine, inputs=None, outputs=gr.Plot()).launch()
```

### Plotly

```python theme={null}
import gradio as gr
import plotly.graph_objects as go

def create_plotly():
    fig = go.Figure(
        data=[go.Bar(x=[1, 2, 3], y=[4, 5, 6])]
    )
    fig.update_layout(title="Bar Chart")
    return fig

gr.Interface(fn=create_plotly, inputs=None, outputs=gr.Plot()).launch()
```


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