Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(maidr.show): support interactive maidr plots within Jupyter Notebooks, VS Code, Google Colab, and Quarto #64

Merged
merged 13 commits into from
Aug 21, 2024
Merged
137 changes: 137 additions & 0 deletions example/bar/example_bar_plot.ipynb

Large diffs are not rendered by default.

246 changes: 246 additions & 0 deletions example/box/example_box_plot.ipynb

Large diffs are not rendered by default.

69 changes: 69 additions & 0 deletions example/count/example_count_plot.ipynb

Large diffs are not rendered by default.

154 changes: 154 additions & 0 deletions example/heatmap/example_heatmap_plot.ipynb

Large diffs are not rendered by default.

121 changes: 121 additions & 0 deletions example/histogram/example_histogram_plot.ipynb

Large diffs are not rendered by default.

137 changes: 137 additions & 0 deletions example/line/example_line_plot.ipynb

Large diffs are not rendered by default.

5,137 changes: 5,137 additions & 0 deletions example/quarto/demo.html

Large diffs are not rendered by default.

116 changes: 116 additions & 0 deletions example/quarto/demo.qmd
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.
Loading
Loading