-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path100_Multidistributions.py
76 lines (51 loc) · 2.64 KB
/
100_Multidistributions.py
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# Pandas
import pandas as pd
# Constants
from src import constants
# Seagull
from src.Seagull.Seagull import Seagull
# Plots
from src.Plot.VN_Plots.VN_Numerical.VN_Distributions import Distributions_plot
def main():
# Where do you want to save the plots
# Otherwise they will go to cwd()
save_folder = constants.DENSITY_PLOTS_PATH
print("---------------------------------------------------------------")
print(" LOADING DATASETS ")
print("---------------------------------------------------------------")
# region
# Load the Iris dataset
irisDF = Seagull()
irisDF.set_iris()
print("---------------------------------------------------------------")
print(" Create a plot with random data and save it ")
print("---------------------------------------------------------------")
# Create the plot with random data and save it in the given folder
my_plot = Distributions_plot(folder_path = save_folder)
my_plot.save() # "Multidensity_Plot.png"
print("---------------------------------------------------------------")
print(" Create a plot and init from Seagull ")
print("---------------------------------------------------------------")
# Notice that this example doesn't make much sense,
# we are comparing the length and width of all types
# of flowers in the Iris dataset.
#
# A more sensible example would be to compare the
# length or width for each type of flower.
my_plot = Distributions_plot(folder_path = save_folder)
my_plot.init_from_seagull(irisDF, numerical_column = ['sepal length (cm)', 'sepal width (cm)'])
my_plot.set_title("Comparing all lengths and widths")
my_plot.set_subtitle("Clearly different!")
my_plot.save() # "Multidensity_Plot_Iris dataset_0_1"
print("---------------------------------------------------------------")
print(" Create a plot and init from Seagull (proper categories) ")
print("---------------------------------------------------------------")
# Proper example, comparing the length and width for each type of flower.
my_plot = Distributions_plot(folder_path = save_folder)
my_plot.init_from_seagull(irisDF, numerical_column = 'sepal length (cm)', categorical_column = 'species')
my_plot.set_title("Comparing lengths")
my_plot.save() # "Multidensity_Plot_Iris dataset_0_1"
# Return and end example
return 0
if __name__ == "__main__":
main()