-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathseaborn.py
More file actions
44 lines (36 loc) · 1.32 KB
/
seaborn.py
File metadata and controls
44 lines (36 loc) · 1.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
""" anyplot.ai
scatter-marginal: Scatter Plot with Marginal Distributions
Library: seaborn 0.13.2 | Python 3.13.13
Quality: 91/100 | Updated: 2026-05-09
"""
import numpy as np
import seaborn as sns
# Data - correlated bivariate data to demonstrate scatter + marginal distributions
np.random.seed(42)
n_points = 200
x = np.random.randn(n_points) * 15 + 50
y = 0.7 * x + np.random.randn(n_points) * 10 + 20
# Create jointplot with scatter and marginal histograms+KDE
sns.set_context("talk", font_scale=1.4)
g = sns.jointplot(
x=x,
y=y,
kind="scatter",
height=12,
ratio=5,
marginal_kws={"bins": 25, "kde": True, "color": "#306998", "alpha": 0.7},
joint_kws={"s": 150, "alpha": 0.65, "color": "#306998", "edgecolor": "white", "linewidth": 0.5},
)
# Style the central scatter plot
g.ax_joint.set_xlabel("X Value", fontsize=22)
g.ax_joint.set_ylabel("Y Value", fontsize=22)
g.ax_joint.tick_params(axis="both", labelsize=16)
g.ax_joint.grid(True, alpha=0.3, linestyle="--")
# Style marginal plots
g.ax_marg_x.tick_params(axis="both", labelsize=14)
g.ax_marg_y.tick_params(axis="both", labelsize=14)
# Add title to figure
g.figure.suptitle("scatter-marginal · seaborn · pyplots.ai", fontsize=26, y=0.98)
g.figure.subplots_adjust(top=0.92)
# Save at high resolution
g.figure.savefig("plot.png", dpi=300, bbox_inches="tight")