-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: support interactivity within ipython and quarto (#64)
- Loading branch information
1 parent
5af72c2
commit 620ddc9
Showing
29 changed files
with
9,510 additions
and
2 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
--- | ||
title: "Accessible Data Representation Demo" | ||
author: "JooYoung Seo" | ||
institute: "(x)Ability Design Lab" | ||
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("Histogram of 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("Line Plot of 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("Heatmap of 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) | ||
``` |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.