> ## Documentation Index
> Fetch the complete documentation index at: https://ai.tharung.in/llms.txt
> Use this file to discover all available pages before exploring further.

# Multiplot dashboard Practice

# Combining Multiple Plots

## Introduction

Data visualization helps us understand data patterns, trends, and relationships easily.<br />A dashboard combines different types of charts in one place to provide a complete view of data.

In this notebook, we create **three different plots**:

1. **Line Plot** - Used to show trends over time.
2. **Bar Plot** - Used to compare values between categories.
3. **Heatmap** - Used to display relationships between variables.

### Libraries Used

* **Pandas**: Used for data handling and analysis.
* **NumPy**: Used for generating numerical data.
* **Matplotlib**: Used for creating basic visualizations.
* **Seaborn**: Used for advanced statistical plots.

***

# 1. Line Plot - Monthly Sales Trend

A **line plot** represents data points connected by lines.<br />It is mainly used to understand changes and trends over time.

### Objective:

To visualize monthly sales performance from January to June.

### Code:

```python theme={null}
months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun"]

sales = [120, 150, 170, 160, 190, 220]

plt.figure(figsize=(8, 4))
plt.plot(months, sales, marker="o", linewidth=2)

plt.title("Monthly Sales")
plt.xlabel("Month")
plt.ylabel("Sales")

plt.show()
```

<Frame>
  <img src="https://mintcdn.com/ai-923f8160/kCAzjeXndKm83XZG/images/Day14-Lineplot.png?fit=max&auto=format&n=kCAzjeXndKm83XZG&q=85&s=fdd12fdc677866caadda015bb5c5272c" alt="Day14 Lineplot" width="694" height="391" data-path="images/Day14-Lineplot.png" />
</Frame>

### Observation:

* Sales show an overall increasing trend.
* A small decrease can be seen in April.
* The highest sales are recorded in June.

### Uses of Line Plot:

* Tracking sales trends.
* Monitoring growth over time.
* Analyzing time-series data.

***

# 2. Bar Plot - Revenue by Category

A **bar plot** represents data using rectangular bars.<br />It is useful for comparing values among different categories.

### Objective:

To compare revenue generated by different product categories.

### Code:

```python theme={null}
categories = ["Electronics", "Furniture", "Clothing", "Books"]

revenue = [320, 210, 270, 140]

plt.figure(figsize=(8, 4))
plt.bar(categories, revenue)

plt.title("Revenue by Category")
plt.ylabel("Revenue")

plt.show()
```

<Frame>
  <img src="https://mintcdn.com/ai-923f8160/kCAzjeXndKm83XZG/images/Day14-barplot.png?fit=max&auto=format&n=kCAzjeXndKm83XZG&q=85&s=a2d1ffd9b94edab330344de7dd6a487f" alt="Day14 Barplot" width="694" height="377" data-path="images/Day14-barplot.png" />
</Frame>

### Observation:

* Electronics generates the highest revenue.
* Furniture and Clothing have moderate revenue.
* Books generate the lowest revenue.

### Uses of Bar Plot:

* Comparing categories.
* Analyzing product performance.
* Displaying survey or business data.

***

# 3. Heatmap - Correlation Analysis

A **heatmap** displays data values using different colors.<br />It helps identify relationships between numerical variables.

### Objective:

To find correlations between Sales, Profit, Customers, and Returns.

### Creating Dataset:

```python theme={null}
np.random.seed(42)

df = pd.DataFrame(
    {
        "Sales": np.random.randint(100, 300, 50),
        "Profit": np.random.randint(20, 100, 50),
        "Customers": np.random.randint(10, 50, 50),
        "Returns": np.random.randint(0, 15, 50),
    }
)
```

### Code:

```python theme={null}
plt.figure(figsize=(6, 5))

sns.heatmap(
    df.corr(),
    annot=True,
    cmap="viridis"
)

plt.title("Correlation Heatmap")

plt.show()
```

<Frame>
  <img src="https://mintcdn.com/ai-923f8160/kCAzjeXndKm83XZG/images/Day14-Heatmap.png?fit=max&auto=format&n=kCAzjeXndKm83XZG&q=85&s=05159feb926f87a7d699023d7e63ef92" alt="Day14 Heatmap" width="495" height="453" data-path="images/Day14-Heatmap.png" />
</Frame>

### Observation:

* Heatmap shows the relationship between different variables.
* Values close to **1** indicate positive correlation.
* Values close to **-1** indicate negative correlation.
* Helps identify important patterns in data.

### Uses of Heatmap:

* Correlation analysis.
* Finding relationships between variables.
* Understanding complex datasets.

***

# Combining Plots into a Dashboard

A dashboard combines multiple visualizations to provide meaningful insights.

The three plots created in this notebook provide different views:

| Visualization | Purpose                               |
| ------------- | ------------------------------------- |
| Line Plot     | Shows monthly sales trends            |
| Bar Plot      | Compares revenue categories           |
| Heatmap       | Shows relationships between variables |

***

# Conclusion

Combining multiple plots in a single notebook helps analyze data from different perspectives.

* Line plots help understand trends.
* Bar plots help compare categories.
* Heatmaps help analyze relationships.

Together, these visualizations create a simple dashboard that improves data understanding and supports better decision-making.
