
---

# SET A

## Q1 — Pandas Column Types (Numerical, Categorical, Temporal)

```python
import pandas as pd

data = {
 "age":[25,30,22,40],
 "salary":[50000,60000,45000,80000],
 "gender":["M","F","F","M"],
 "city":["NY","LA","SF","CHI"],
 "join_date":["2022-01-15","2021-05-10","2023-03-20","2020-07-01"]
}

df = pd.DataFrame(data)

df["join_date"] = pd.to_datetime(df["join_date"])

numerical_cols = df.select_dtypes(include=['int64','float64']).columns.tolist()
categorical_cols = df.select_dtypes(include=['object']).columns.tolist()
temporal_cols = df.select_dtypes(include=['datetime64']).columns.tolist()

print("Numerical Columns:",numerical_cols)
print("Categorical Columns:",categorical_cols)
print("Temporal Columns:",temporal_cols)
```

Output

```
Numerical Columns: ['age', 'salary']
Categorical Columns: ['gender', 'city']
Temporal Columns: ['join_date']
```

---

# Q2 — Iris Dataset Visualization (Bar, Line, Scatter)

```python
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
from sklearn.datasets import load_iris

iris = load_iris(as_frame=True)
df = iris.frame

df["species"] = df["target"].map(dict(enumerate(iris.target_names)))

df.groupby("species")["petal length (cm)"].mean().plot(kind="bar")
plt.title("Average Petal Length by Species")
plt.ylabel("Petal Length (cm)")
plt.show()

df["sepal length (cm)"].plot(kind="line")
plt.title("Sepal Length Line Plot")
plt.xlabel("Index")
plt.ylabel("Sepal Length (cm)")
plt.show()

sns.scatterplot(data=df,x="sepal length (cm)",y="sepal width (cm)",hue="species")
plt.title("Sepal Length vs Sepal Width")
plt.show()
```

---

# Q3 — Iris Species Count (Bar Chart and Pie Chart)

```python
import pandas as pd
import matplotlib.pyplot as plt
from sklearn.datasets import load_iris

iris = load_iris(as_frame=True)
df = iris.frame

df["species"] = df["target"].map(dict(enumerate(iris.target_names)))

counts = df["species"].value_counts()

print("Species Counts:")
print(counts)

counts.plot(kind="bar",title="Iris Species Count - Bar Chart")
plt.xlabel("Species")
plt.ylabel("Count")
plt.show()

counts.plot(kind="pie",autopct="%1.1f%%",title="Iris Species Distribution - Pie Chart")
plt.ylabel("")
plt.show()
```

Output

```
Species Counts:
species
setosa 50
versicolor 50
virginica 50
Name: count, dtype: int64
```

---

# Q4 — Histogram with Mean and Median

```python
import numpy as np
import matplotlib.pyplot as plt

data = np.array([12,15,14,18,19,22,25,30,28,26,24,20,18,17,16,15,14])

mean_val = data.mean()
median_val = np.median(data)

print("Mean:",mean_val)
print("Median:",median_val)

plt.hist(data,bins=10,color="lightblue",edgecolor="black")

plt.axvline(mean_val,color="red",linestyle="--",linewidth=2,label=f"Mean({mean_val:.2f})")
plt.axvline(median_val,color="green",linestyle="--",linewidth=2,label=f"Median({median_val:.2f})")

plt.title("Histogram of Data with Mean and Median")
plt.xlabel("Value")
plt.ylabel("Frequency")
plt.legend()
plt.show()
```

Output

```
Mean: 19.58823529411765
Median: 18.0
```

---

# Q5 — Bar Chart and Pie Chart (Categories)

```python
import matplotlib.pyplot as plt

categories=["A","B","C"]
values=[30,45,25]

plt.bar(categories,values,color=["black","orange","green"])
plt.title("Bar Chart of Categories")
plt.xlabel("Category")
plt.ylabel("Value")
plt.show()

plt.pie(values,labels=categories,autopct="%1.1f%%")
plt.title("Pie Chart of Categories")
plt.show()
```

---

# SET B

# Q1 — Streamline Plot using Iris Dataset

```python
import numpy as np
import matplotlib.pyplot as plt
from sklearn.datasets import load_iris

iris = load_iris()
data = iris.data

x_feature = data[:,2]
y_feature = data[:,3]

x = np.linspace(x_feature.min(),x_feature.max(),100)
y = np.linspace(y_feature.min(),y_feature.max(),100)

X,Y = np.meshgrid(x,y)

U = np.sin(X)*Y
V = np.cos(Y)*X

plt.figure(figsize=(7,6))
plt.streamplot(X,Y,U,V,color=np.sqrt(U**2+V**2),cmap="plasma")

plt.title("Streamline Plot Using Iris Dataset Features")
plt.show()
```

---

# Q2 — Treemap and Network Graph

```python
import matplotlib.pyplot as plt
import squarify
import networkx as nx

labels=["HR","Engineering\n- Backend","Engineering\n- Frontend","Sales"]
sizes=[10,30,20,15]

plt.figure(figsize=(12,5))

plt.subplot(1,2,1)
squarify.plot(sizes=sizes,label=labels,alpha=0.8)
plt.axis("off")
plt.title("Company Structure (Treemap)")

G = nx.Graph()
edges=[("Alice","Bob"),("Bob","Claire"),("Claire","David"),("Alice","Eve")]
G.add_edges_from(edges)

plt.subplot(1,2,2)
pos = nx.spring_layout(G,seed=42)

nx.draw(G,pos,with_labels=True,node_color="skyblue",node_size=2000)

plt.title("Simple Network Graph")
plt.tight_layout()
plt.show()
```

---

# Q3 — Plotly Treemap (Organization Hierarchy)

```python
import plotly.express as px

data = dict(
names=["Company","CEO","CTO","Engineering Manager","Developer A","Developer B","CFO","Accountant A","Accountant B"],
parents=["","Company","CEO","CEO","CTO","CTO","CEO","CFO","CFO"],
values=[1]*9
)

fig = px.treemap(
data,
names="names",
parents="parents",
values="values",
title="Company Organizational Hierarchy"
)

fig.show()
```

---

# Q4 — Folium Choropleth Map (COVID Cases)

```python
import folium
import pandas as pd

data = pd.DataFrame({
"district":["North","South","East"],
"cases":[120,300,180]
})

geojson={
"type":"FeatureCollection",
"features":[
{"type":"Feature","properties":{"district":"North"},
"geometry":{"type":"Polygon","coordinates":[[[0,0],[2,0],[2,2],[0,2],[0,0]]]}}
,
{"type":"Feature","properties":{"district":"South"},
"geometry":{"type":"Polygon","coordinates":[[[0,-1],[2,-1],[2,-3],[0,-3],[0,-1]]]}}
,
{"type":"Feature","properties":{"district":"East"},
"geometry":{"type":"Polygon","coordinates":[[[3,0],[5,0],[5,-2],[3,-2],[3,0]]]}}
]
}

m = folium.Map(location=[0,0],zoom_start=4)

folium.Choropleth(
geo_data=geojson,
data=data,
columns=["district","cases"],
key_on="feature.properties.district",
fill_color="Reds",
fill_opacity=0.7,
line_opacity=0.5,
legend_name="COVID-19 Cases"
).add_to(m)

for feature in geojson["features"]:
 coords = feature["geometry"]["coordinates"][0]
 lat = sum([pt[1] for pt in coords]) / len(coords)
 lon = sum([pt[0] for pt in coords]) / len(coords)

 district = feature["properties"]["district"]
 cases = data.loc[data["district"]==district,"cases"].values[0]

 folium.Marker([lat,lon],popup=f"{district}:{cases} cases").add_to(m)

m
```

---

# Q5 — Interactive Plotly Dashboard (Dropdown Scatter)

```python
import plotly.express as px
import pandas as pd
import ipywidgets as widgets
from IPython.display import display

data = pd.DataFrame({
"Sales":[100,150,200,130,170,220],
"Profit":[20,30,40,25,35,50],
"Expenses":[80,120,160,100,135,170],
"Month":["Jan","Feb","Mar","Apr","May","Jun"],
"Region":["North","South","East","West","North","South"]
})

x_dropdown = widgets.Dropdown(
options=["Sales","Profit","Expenses"],
value="Sales",
description="X-axis:"
)

y_dropdown = widgets.Dropdown(
options=["Sales","Profit","Expenses"],
value="Profit",
description="Y-axis:"
)

output = widgets.Output()

def update_plot(change):
 with output:
  output.clear_output(wait=True)

  x_feature = x_dropdown.value
  y_feature = y_dropdown.value

  fig = px.scatter(
  data,
  x=x_feature,
  y=y_feature,
  color="Region",
  labels={x_feature:x_feature,y_feature:y_feature},
  title=f"{x_feature} vs {y_feature} by Region",
  hover_data=["Month","Region"]
  )

  fig.update_layout(template="plotly_white",margin=dict(l=50,r=50,t=50,b=50))

  display(fig)
  print(f"Selected X-axis: {x_feature}, Y-axis: {y_feature}")

x_dropdown.observe(update_plot,names="value")
y_dropdown.observe(update_plot,names="value")

dashboard = widgets.VBox([widgets.HBox([x_dropdown,y_dropdown]),output])

display(dashboard)

update_plot(None)
```

---

# Q6 — PCA Visualization (Iris Dataset)

```python
import matplotlib.pyplot as plt
from sklearn.datasets import load_iris
from sklearn.preprocessing import StandardScaler
from sklearn.decomposition import PCA

iris = load_iris()

X = iris.data
y = iris.target

X_scaled = StandardScaler().fit_transform(X)

pca = PCA(n_components=2)

X_pca = pca.fit_transform(X_scaled)

print("Explained variance ratio:",pca.explained_variance_ratio_)

plt.scatter(X_pca[:,0],X_pca[:,1],c=y)

plt.xlabel("Principal Component 1")
plt.ylabel("Principal Component 2")
plt.title("PCA: First Two Principal Components")

plt.colorbar(label="Class")

plt.show()
```

Output

```
Explained variance ratio: [0.72962445 0.22850762]
```

---


Below are your **same questions (unchanged)** with **shorter and simpler code** while keeping the **same output and logic**.
I removed **extra variables and unnecessary lines** but kept everything **correct for practical exams**.

---

# SET A

## Q1) Use Python (scikit-learn) to perform Principal Component Analysis (PCA) on a high-dimensional dataset. Visualize the first two principal components.

```python
import matplotlib.pyplot as plt
from sklearn.datasets import load_iris
from sklearn.preprocessing import StandardScaler
from sklearn.decomposition import PCA

X,y = load_iris(return_X_y=True)

X = StandardScaler().fit_transform(X)

X2 = PCA(2).fit_transform(X)

plt.scatter(X2[:,0],X2[:,1],c=y)
plt.xlabel("PC1")
plt.ylabel("PC2")
plt.title("PCA")
plt.colorbar()
plt.show()
```

---

# Q2) Load the Iris dataset in R. Perform PCA and visualize the first two principal components as a scatter plot. Compare both outputs.

```r
pca <- prcomp(iris[,1:4], scale.=TRUE)

summary(pca)

plot(pca$x[,1:2],
 col=as.numeric(iris$Species),
 pch=19,
 xlab="PC1",
 ylab="PC2",
 main="PCA of Iris Dataset")

legend("topright",levels(iris$Species),col=1:3,pch=19)
```

---

# Q3) Use R (ggplot2) to visualize multidimensional data (e.g., a pair plot or a 3D scatter plot).

```r
library(plotly)

plot_ly(iris,
 x=~Sepal.Length,
 y=~Sepal.Width,
 z=~Petal.Length,
 color=~Species,
 type="scatter3d",
 mode="markers")
```

---

# Q4) Apply k-means clustering to a dataset in R and visualize the clusters in 2D space.

```r
set.seed(123)

km <- kmeans(iris[,1:4],3)

plot(iris$Petal.Length,iris$Petal.Width,
 col=km$cluster,
 pch=19,
 main="K-means Clustering")

points(km$centers[,3:4],pch=8,cex=2)
```

---

# Q5) Create a 3D scatter plot using R plotly for high-dimensional data reduced by PCA.

```r
library(plotly)

pca <- prcomp(iris[,1:4],scale.=TRUE)

plot_ly(
 x=pca$x[,1],
 y=pca$x[,2],
 z=pca$x[,3],
 color=iris$Species,
 type="scatter3d",
 mode="markers"
)
```

---

# SET B

## Q1) Generate a heatmap for feature correlation of a high-dimensional dataset using R .

```r
c <- cor(iris[,1:4])

heatmap(c,
 main="Feature Correlation Heatmap")
```

---

# Q2) Build a Google Bubble Chart to visualize clusters (Cluster ID = color, size = feature mean) using R.

```r
library(plotly)

set.seed(123)
km <- kmeans(iris[,1:4],3)

cs <- aggregate(cbind(Petal.Length,Petal.Width)~km$cluster,iris,mean)

plot_ly(cs,
 x=~Petal.Length,
 y=~Petal.Width,
 size=~Petal.Length,
 color=~factor(`km$cluster`),
 type="scatter",
 mode="markers")
```

---

# Q3) “Using plotly in R, create an interactive matrix of scatter plots for Sepal.Length, Sepal.Width, Petal.Length, and Petal.Width from the iris dataset. Differentiate species by color and show species information when hovering over points.”

```r
library(plotly)

plot_ly(
 iris,
 type="splom",
 dimensions=list(
 list(label="Sepal.Length",values=~Sepal.Length),
 list(label="Sepal.Width",values=~Sepal.Width),
 list(label="Petal.Length",values=~Petal.Length),
 list(label="Petal.Width",values=~Petal.Width)
 ),
 color=~Species,
 text=~Species
)
```

---

# Q4) “Using the iris dataset in R, create an interactive scatter plot to explore the relationship between two numeric features (e.g., Sepal.Length and Sepal.Width). Color the points by species and display the species and feature values when hovering over the points.”

```r
library(plotly)

plot_ly(
 iris,
 x=~Sepal.Length,
 y=~Sepal.Width,
 color=~Species,
 type="scatter",
 mode="markers",
 text=~paste(Species,Sepal.Length,Sepal.Width)
)
```

---

# Q5) Use PCA to compress a dataset from 10D → 2D and then reconstruct it. Plot original vs reconstructed values.

```r
set.seed(123)

X <- matrix(rnorm(100*10),100,10)

pca <- prcomp(X,scale.=TRUE)

Z <- pca$x[,1:2]

Xr <- Z %*% t(pca$rotation[,1:2]) + matrix(pca$center,100,10,TRUE)

par(mfrow=c(1,2))

plot(X[,1],type="l",col="blue",main="Original X1")
plot(Xr[,1],type="l",col="red",main="Reconstructed X1")
```

---


Here is your **ASSIGNMENT 3 – SET A and SET B written again together**.
Even if **Q4 and Q5 are not simplified**, they are **kept the same (only formatting improved)** as you asked.

---

# ASSIGNMENT 3

# SET A

## Q1.

Given a scatter plot containing five distinct clusters, redesign the visualization to demonstrate each of the following Gestalt principles:

* Proximity
* Similarity
* Continuity
* Closure
* Figure–Ground

Explain how each modification influences viewer perception.

```python
import matplotlib.pyplot as plt
import numpy as np

np.random.seed(42)
n_points = 20
colors = ['red','blue','green','orange','yellow']
clusters = []

for i in range(5):
    x = np.random.randn(n_points) + i*5
    y = np.random.randn(n_points) + i*2
    clusters.append((x,y))

plt.figure(figsize=(18,12))

# 1. Proximity
plt.subplot(2,3,1)
for x,y in clusters:
    plt.scatter(x,y,s=100,color='blue')
plt.title("1. Proximity")

# 2. Similarity
plt.subplot(2,3,2)
for (x,y),c in zip(clusters,colors):
    plt.scatter(x,y,s=100,color=c)
plt.title("2. Similarity")
plt.axis('off')

# 3. Continuity
plt.subplot(2,3,3)
for (x,y),c in zip(clusters,colors):
    plt.plot(x,y,color=c,linewidth=2)
    plt.scatter(x,y,s=80,color=c)
plt.title("3. Continuity")
plt.axis('off')

# 4. Closure
plt.subplot(2,3,4)
for i,c in enumerate(colors):
    theta = np.linspace(0,1.7*np.pi,n_points)
    r = 1.5
    x_circle = r*np.cos(theta)+i*5
    y_circle = r*np.sin(theta)+5
    plt.scatter(x_circle,y_circle,s=80,color=c)
plt.title("4. Closure")
plt.axis("off")

# 5. Figure-Ground
plt.subplot(2,3,5)
for (x,y) in clusters:
    plt.scatter(x,y,s=80,color='gray')
plt.scatter(clusters[0][0],clusters[0][1],s=120,color='red')
plt.title("5. Figure-Ground")
plt.axis('off')

plt.tight_layout()
plt.show()
```

OUTPUT

---

## Q2.

Visualize GDP, population, and literacy rate for selected countries on a world map.

Select appropriate visual encodings:

* Color
* Size
* Shape
* Texture

```python
import pandas as pd
import plotly.express as px

data = {
"Country":["India","China","USA"],
"ISO_Code":["USA","China","India"],
"GDP":[21333,12345,543633],
"Population":[331,1234,5423],
"Literacy_rate":[99,97,55]
}

df = pd.DataFrame(data)

fig = px.scatter_geo(
    df,
    locations="ISO_Code",
    color="GDP",
    size="Population",
    hover_name="Country",
    hover_data={"GDP":True,"Population":True,"Literacy_rate":True},
    projection="natural earth",
    title="Global Visualization: GDP, Population, and Literacy Rate"
)

fig.show()
```

OUTPUT

---

## Q3.

Using the Iris dataset, assign five dataset variables to appropriate visual channels:

* Color
* Shape
* Size
* Texture
* Position

Justify your mapping decisions and create a visualization implementing them.

```python
import seaborn as sns
import matplotlib.pyplot as plt

iris = sns.load_dataset("iris")

median = iris["petal_width"].median()

small = iris[iris["petal_width"] < median]
large = iris[iris["petal_width"] >= median]

plt.scatter(small.sepal_length, small.sepal_width, marker='o')
plt.scatter(large.sepal_length, large.sepal_width, marker='s')

plt.xlabel("Sepal Length")
plt.ylabel("Sepal Width")
plt.title("Iris Visualization")

plt.show()
```

OUTPUT

---

## Q4.

A dataset containing **10,000 data points** results in severe overplotting.

Reduce overlap and compare the raw and improved visualizations.

```python
import numpy as np
import matplotlib.pyplot as plt

x = np.random.normal(0,1,10000)
y = np.random.normal(0,1,10000)

plt.figure(figsize=(10,4))

plt.subplot(1,2,1)
plt.scatter(x,y)
plt.title("Normal Scatter")

plt.subplot(1,2,2)
plt.scatter(x,y,alpha=0.05)
plt.title("With Transparency")

plt.tight_layout()
plt.show()
```

OUTPUT

---

## Q5.

Using the Iris dataset, create a scatter plot that resolves overlapping data using transparency.

```python
import seaborn as sns

iris = sns.load_dataset("iris")

sns.scatterplot(data=iris,x="sepal_length",y="sepal_width",hue="species")
```

OUTPUT

---

# SET B

## Q1.

Convert continuous variables into discrete bins and create a texture-based heatmap visualization.

```python
import seaborn as sns
import matplotlib.pyplot as plt

iris = sns.load_dataset("iris")

sns.heatmap(iris.corr(numeric_only=True),annot=True)

plt.show()
```

OUTPUT

---

## Q2.

Consider a random six-dimensional dataset:

* Create a correlation heatmap to identify relationships.
* Generate a parallel coordinates plot to explore multidimensional patterns.

```python
import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
from pandas.plotting import parallel_coordinates
from sklearn.preprocessing import MinMaxScaler

np.random.seed(0)

df = pd.DataFrame({
"Feature_A":np.random.normal(0,1,100),
"Feature_B":np.random.normal(0,1,100),
"Feature_C":np.random.normal(5,2,100),
"Feature_D":np.random.normal(5,2,100),
"Feature_E":np.random.normal(0,10,100),
"Feature_F":np.random.normal(0,10,100)
})

df["Feature_B"] = df["Feature_A"]*0.8 + np.random.normal(0,0.3,100)
df["Feature_D"] = df["Feature_C"]*0.9 + np.random.normal(0,0.4,100)

plt.figure(figsize=(7,5))
sns.heatmap(df.corr(),annot=True,cmap="coolwarm",center=0)
plt.title("Correlation")
plt.tight_layout()
plt.show()

scaler = MinMaxScaler()

df_scaled = pd.DataFrame(
    scaler.fit_transform(df),
    columns=df.columns
)

df_scaled["Group"] = "Data"

plt.figure(figsize=(10,5))
parallel_coordinates(df_scaled,"Group",alpha=0.4)

plt.title("Parallel Coordinate")
plt.xlabel("Scaled Value")

plt.tight_layout()
plt.show()
```

OUTPUT

---

## Q3.

Create an animated chart (example: moving bubble chart) in Python using Plotly to show changes over time.

```python
import pandas as pd
import plotly.express as px

df = pd.DataFrame({
"year":[2020,2020,2020,2021,2021,2021,2022,2022,2022],
"category":["A","B","C"]*3,
"x":[10,20,30,15,25,35,20,30,40],
"y":[40,30,20,45,35,25,50,40,30],
"size":[100,200,300,150,250,350,200,300,400]
})

fig = px.scatter(
    df,
    x="x",
    y="y",
    size="size",
    color="category",
    animation_frame="year",
    title="Animated Scatter"
)

fig.show()
```

OUTPUT

---

## Q4.

Create an animation of stock market prices as a moving scatter plot. Identify short-term vs long-term motion patterns.

```python
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.animation import FuncAnimation
from IPython.display import HTML

np.random.seed(0)

days = 150
price = np.cumsum(np.random.normal(0,1,days)) + 100

# Long-term moving average
long_trend = np.convolve(price,np.ones(15)/15,mode='same')

fig, ax = plt.subplots()

ax.set_xlim(0,days)
ax.set_ylim(min(price)-5,max(price)+5)

scatter = ax.scatter([],[],color='blue')
line, = ax.plot([],[],color='red')

def update(frame):
    scatter.set_offsets(np.c_[range(frame),price[:frame]])
    line.set_data(range(frame),long_trend[:frame])
    return scatter,line

ani = FuncAnimation(fig,update,frames=days,interval=50)

HTML(ani.to_jshtml())
```

OUTPUT

---

## Q5.

Design a compact dashboard using any dataset (example: Flights dataset) that includes:

* A visualization resolving overplotting
* A multidimensional pattern visualization
* A texture-based chart

```python
import seaborn as sns
import matplotlib.pyplot as plt

d = sns.load_dataset("flights")

p = d.pivot(index="month",columns="year",values="passengers")

fig, a = plt.subplots(1,3,figsize=(10,3))

# 1. Overplotting resolved (density)
a[0].hexbin(d.year,d.passengers,gridsize=18)
a[0].set_title("Density")

# 2. Multidimensional pattern (heatmap)
sns.heatmap(p,ax=a[1],cbar=False)
a[1].set_title("Heatmap")

# 3. Texture-based chart (hatched bars)
b = a[2].bar(d.year.unique(),d.groupby("year").passengers.sum())

for i in b:
    i.set_hatch('//')

a[2].set_title("Texture Bars")

plt.tight_layout()
plt.show()
```

OUTPUT

---

Here is your **ASSIGNMENT-5 – SET A written cleanly together**, same logic kept, only **formatting improved** (no unnecessary simplification).

---

# ASSIGNMENT – 5

# SET A

## Q1) Using the Iris dataset:

a) Create a **histogram showing mean and median**.
b) Create a **scatter plot showing relationships between two features**.

### SOLUTION:-

```python
import seaborn as sns
import matplotlib.pyplot as plt

iris = sns.load_dataset("iris")

data = iris["sepal_length"]

# Histogram with mean and median
plt.hist(data)
plt.axvline(data.mean(), linestyle="--", linewidth=2, label="Mean")
plt.axvline(data.median(), linestyle="-", linewidth=2, label="Median")
plt.legend()
plt.show()

# Scatter plot
plt.scatter(
    iris["sepal_length"],
    iris["sepal_width"],
    c = iris["species"].astype('category').cat.codes
)

plt.xlabel("Sepal Length")
plt.ylabel("Sepal Width")
plt.title("Sepal Length vs Width")

plt.show()
```

OUTPUT:

---

## Q2) Identify and explain which Gestalt principles are demonstrated in the visualizations:

* Proximity
* Similarity
* Continuity
* Figure Ground

Also determine **which visualization best represents distribution and trend**.

### SOLUTION:-

```python
import seaborn as sns
import matplotlib.pyplot as plt

data = sns.load_dataset("iris")["sepal_length"]

plt.figure(figsize=(12,5))

# Histogram (Distribution)
plt.subplot(1,2,1)
plt.hist(data)
plt.axvline(data.mean(), linestyle="--", linewidth=2, label="Mean")
plt.axvline(data.median(), linestyle="-", linewidth=2, label="Median")
plt.legend()
plt.title("Distribution - Sepal Length")

# Line Plot (Trend)
plt.subplot(1,2,2)
plt.plot(data)
plt.title("Trend - Sepal Length Over Index")

plt.tight_layout()
plt.show()
```

OUTPUT:

---


