---
title: "Accessible Data Representation Demo"
author: "JooYoung Seo"
institute: "(x)Ability Design Lab"
jupyter: python3
format: html
---

## Bar Plot

```{python}
import matplotlib.pyplot as plt
import maidr
import seaborn as sns

# Load the penguins dataset
penguins = sns.load_dataset("penguins")

# Create a bar plot showing the average body mass of penguins by species
plt.figure(figsize=(10, 6))
b_plot = sns.barplot(
    x="species", y="body_mass_g", data=penguins, errorbar="sd", palette="Blues_d"
)
plt.title("Average Body Mass of Penguins by Species")
plt.xlabel("Species")
plt.ylabel("Body Mass (g)")

# plt.show()
maidr.show(b_plot)
```


## Histogram

```{python}
# Load the Iris dataset
iris = sns.load_dataset("iris")

# Select the petal lengths
petal_lengths = iris["petal_length"]

# Plot a histogram of the petal lengths
plt.figure(figsize=(10, 6))
hist_plot = sns.histplot(petal_lengths, kde=True, color="blue", binwidth=0.5)

plt.title("Petal Lengths in Iris Dataset")
plt.xlabel("Petal Length (cm)")
plt.ylabel("Frequency")

# plt.show()
maidr.show(hist_plot)
```


## Line Plot

```{python}
# Load the 'tips' dataset from seaborn
tips = sns.load_dataset("tips")

# Choose a specific subset of the dataset (e.g., data for 'Thursday')
subset_data = tips[tips["day"] == "Thur"]

# Create a line plot
plt.figure(figsize=(10, 6))
line_plot = sns.lineplot(
    data=subset_data,
    x="total_bill",
    y="tip",
    markers=True,
    style="day",
    legend=False,
)
plt.title("Tips vs Total Bill (Thursday)")
plt.xlabel("Total Bill")
plt.ylabel("Tip")

# plt.show()
maidr.show(line_plot)
```


## Heat Map

```{python}
# Load an example dataset from seaborn
glue = sns.load_dataset("glue").pivot(index="Model", columns="Task", values="Score")

# Plot a heatmap
plt.figure(figsize=(10, 8))
heatmap = sns.heatmap(glue, annot=True, fill_label="Score")
plt.title("Model Scores by Task")

# Show the plot
# plt.show()
maidr.show(heatmap)
```


## Scatter Plot

```{python}
# Create a scatter plot
scatter_plot = sns.scatterplot(
    data=iris, x="sepal_length", y="sepal_width", hue="species"
)

# Adding title and labels (optional)
plt.title("Iris Sepal Length vs Sepal Width")
plt.xlabel("Sepal Length")
plt.ylabel("Sepal Width")

# Show the plot
# plt.show()
maidr.show(scatter_plot)
```
