File tree Expand file tree Collapse file tree
plots/matplotlib/scatter/scatter-color-groups Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44"""
55
66import matplotlib .pyplot as plt
7- import seaborn as sns
8-
9-
10- # Data
11- data = sns .load_dataset ("iris" )
7+ import numpy as np
8+ import pandas as pd
9+
10+
11+ # Data - Iris-like dataset
12+ np .random .seed (42 )
13+ n_per_group = 50
14+
15+ data = pd .DataFrame ({
16+ "sepal_length" : np .concatenate ([
17+ np .random .normal (5.0 , 0.35 , n_per_group ),
18+ np .random .normal (5.9 , 0.50 , n_per_group ),
19+ np .random .normal (6.6 , 0.60 , n_per_group ),
20+ ]),
21+ "sepal_width" : np .concatenate ([
22+ np .random .normal (3.4 , 0.38 , n_per_group ),
23+ np .random .normal (2.8 , 0.30 , n_per_group ),
24+ np .random .normal (3.0 , 0.30 , n_per_group ),
25+ ]),
26+ "species" : ["setosa" ] * n_per_group + ["versicolor" ] * n_per_group + ["virginica" ] * n_per_group ,
27+ })
1228
1329# Color palette (colorblind safe from style guide)
1430colors = ["#306998" , "#FFD43B" , "#DC2626" ]
You can’t perform that action at this time.
0 commit comments