forked from xability/py-maidr
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Loading status checks…
feat: support 2-layered scatter plot
1 parent
529c721
commit 6469e24
Showing
6 changed files
with
3,114 additions
and
8 deletions.
There are no files selected for viewing
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,36 @@ | ||
import matplotlib.pyplot as plt | ||
import seaborn as sns | ||
|
||
import maidr | ||
|
||
|
||
penguins = sns.load_dataset("penguins") | ||
|
||
# Initialize the plot | ||
fig, ax = plt.subplots(figsize=(10, 6)) | ||
|
||
# Prepare Scatter plot layer | ||
sns.scatterplot(data=penguins, x="flipper_length_mm", y="body_mass_g", s=100, ax=ax) | ||
|
||
# Prepare Line plot layer | ||
sns.regplot( | ||
data=penguins, | ||
x="flipper_length_mm", | ||
y="body_mass_g", | ||
scatter=False, | ||
lowess=True, | ||
line_kws={"color": "black"}, | ||
ax=ax | ||
) | ||
|
||
ax.set_title("Penguin Flipper Length vs Body Mass (Smoothed)", fontsize=16) | ||
ax.set_xlabel("Flipper Length (mm)", fontsize=14) | ||
ax.set_ylabel("Body Mass (g)", fontsize=14) | ||
|
||
# Create a Maidr instance | ||
maidr_plot = maidr.Maidr(fig) | ||
|
||
html_string = maidr_plot.render(html=True).get_html_string() | ||
|
||
with open("example_scatter_2_layered.html", "w") as f: | ||
f.write(html_string) |
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
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