-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvisualization_layer.py
More file actions
35 lines (33 loc) · 1.46 KB
/
visualization_layer.py
File metadata and controls
35 lines (33 loc) · 1.46 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
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
#from pandas.plotting import parallel_coordinates
def pl(list_plot, consolidated_data):
# list_plot=[["LAI","SPAD","NDVI_mean"]]
groups = consolidated_data.groupby(["ID"])
fig, axes = plt.subplots(
len(list_plot), len(
list_plot[0]), figsize=(
20, 10))
# print(len(list_plot))
for j in range(len(list_plot)):
for h in range(len(list_plot[j])):
group = groups[list_plot[j][h]]
x = group.get_group(1).index.levels[0].to_list()
for i in range(1, len(groups) - 1):
y = group.get_group(i)
if len(list_plot) > 1 and len(list_plot[0]) > 1:
axes[j][h].plot(x, y, label=i, marker='o')
elif len(list_plot) == 1 and len(list_plot[0]) > 1:
axes[h].plot(x, y, label=i, marker='o')
elif len(list_plot) == 1 and len(list_plot[0]) == 1:
axes.plot(x, y, label=i, marker='o')
if len(list_plot) > 1 and len(list_plot[0]) > 1:
axes[j][h].legend()
axes[j][h].set_title(list_plot[j][h])
elif len(list_plot) == 1 and len(list_plot[0]) > 1:
axes[h].legend()
axes[h].set_title(list_plot[j][h])
elif len(list_plot) == 1 and len(list_plot[0]) == 1:
axes.legend()
axes.set_title(list_plot[j][h])