Skip to content

Commit

Permalink
feat!: support syntaxless-api (#47)
Browse files Browse the repository at this point in the history
  • Loading branch information
SaaiVenkat authored Jun 11, 2024
1 parent 53818c9 commit 415d6f1
Show file tree
Hide file tree
Showing 64 changed files with 1,359 additions and 10,430 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ jobs:
uses: psf/black@stable
with:
options: "--diff --check --color --verbose"
version: "23.3.0"


commit-lint:
runs-on: ubuntu-latest
Expand Down
337 changes: 0 additions & 337 deletions example/bar/matplotlib/example_mpl_bar_plot.html

This file was deleted.

42 changes: 11 additions & 31 deletions example/bar/matplotlib/example_mpl_bar_plot.py
Original file line number Diff line number Diff line change
@@ -1,37 +1,17 @@
import os

import matplotlib.pyplot as plt
import maidr
import seaborn as sns

# Load dataset
tips = sns.load_dataset("tips")

def get_filepath(filename: str) -> str:
current_file_path = os.path.abspath(__file__)
directory = os.path.dirname(current_file_path)
return os.path.join(directory, filename)


def plot():
# Load dataset
tips = sns.load_dataset("tips")

# Create a bar plot
cut_counts = tips["day"].value_counts()
plt.figure(figsize=(10, 6))
b_plot = plt.bar(cut_counts.index, list(cut_counts.values), color="skyblue")
plt.title("The Number of Tips by Day")
plt.xlabel("Day")
plt.ylabel("Count")

return b_plot


def main():
bar_plot = plot()
bar_maidr = maidr.bar(bar_plot)
bar_maidr.save_html(get_filepath("example_mpl_bar_plot.html"))
bar_maidr.show()

# Create a bar plot
cut_counts = tips["day"].value_counts()
plt.figure(figsize=(10, 6))
b_plot = plt.bar(cut_counts.index, list(cut_counts.values), color="skyblue")
plt.title("The Number of Tips by Day")
plt.xlabel("Day")
plt.ylabel("Count")

if __name__ == "__main__":
main()
plt.show()
maidr.show(b_plot)
396 changes: 0 additions & 396 deletions example/bar/seaborn/example_sns_bar_plot.html

This file was deleted.

52 changes: 19 additions & 33 deletions example/bar/seaborn/example_sns_bar_plot.py
Original file line number Diff line number Diff line change
@@ -1,38 +1,24 @@
import os

import matplotlib.pyplot as plt
import maidr
import seaborn as sns


def get_filepath(filename: str) -> str:
current_file_path = os.path.abspath(__file__)
directory = os.path.dirname(current_file_path)
return os.path.join(directory, filename)


def plot():
# 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)")

return b_plot


def main():
bar_plot = plot()
bar_maidr = maidr.bar(bar_plot)
bar_maidr.save_html(get_filepath("example_sns_bar_plot.html"))
bar_maidr.show()


if __name__ == "__main__":
main()
# 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",
library="seaborn z",
)
plt.title("Average Body Mass of Penguins by Species")
plt.xlabel("Species")
plt.ylabel("Body Mass (g)")

plt.show()
maidr.show(b_plot)
469 changes: 0 additions & 469 deletions example/box/matplotlib/example_mpl_box.html

This file was deleted.

65 changes: 22 additions & 43 deletions example/box/matplotlib/example_mpl_box.py
Original file line number Diff line number Diff line change
@@ -1,54 +1,33 @@
import os

import matplotlib.pyplot as plt
import maidr
import numpy as np


def get_filepath(filename: str) -> str:
current_file_path = os.path.abspath(__file__)
directory = os.path.dirname(current_file_path)
return os.path.join(directory, filename)


def plot():
# Generating random data for three different groups
data_group1 = np.random.normal(100, 10, 200)
data_group2 = np.random.normal(90, 20, 200)
data_group3 = np.random.normal(80, 30, 200)

# Combine these different datasets into a list
data_to_plot = [data_group1, data_group2, data_group3]

# Create a figure instance
fig, ax = plt.subplots()

# Create the boxplot
bp = ax.boxplot(data_to_plot, patch_artist=True)

# Customize the boxplot colors
colors = ["lightblue", "lightgreen", "tan"]
for patch, color in zip(bp["boxes"], colors):
patch.set_facecolor(color)

# Adding labels and title
ax.set_xticklabels(["Group 1", "Group 2", "Group 3"])
ax.set_title("Box Plot Example")
ax.set_xlabel("Group")
ax.set_ylabel("Values")
# Generating random data for three different groups
data_group1 = np.random.normal(100, 10, 200)
data_group2 = np.random.normal(90, 20, 200)
data_group3 = np.random.normal(80, 30, 200)

# Show the plot
plt.show()
# Combine these different datasets into a list
data_to_plot = [data_group1, data_group2, data_group3]

return bp
# Create a figure instance
fig, ax = plt.subplots()

# Create the boxplot
bp = ax.boxplot(data_to_plot, patch_artist=True)

def main():
box_plot = plot()
box_maidr = maidr.box(box_plot)
box_maidr.save_html(get_filepath("example_mpl_box.html"))
box_maidr.show()
# Customize the boxplot colors
colors = ["lightblue", "lightgreen", "tan"]
for patch, color in zip(bp["boxes"], colors):
patch.set_facecolor(color)

# Adding labels and title
ax.set_xticklabels(["Group 1", "Group 2", "Group 3"])
ax.set_title("Box Plot Example")
ax.set_xlabel("Group")
ax.set_ylabel("Values")

if __name__ == "__main__":
main()
# Show the plot
plt.show()
maidr.show(bp)
Loading

0 comments on commit 415d6f1

Please sign in to comment.