line_tracking_of_fish_movement/plot_material_connect_ID.py

137 lines
4.3 KiB
Python

import numpy as np
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
import matplotlib.colors as mcolors
import matplotlib.gridspec as gridspec
import math
from IPython import embed
from scipy import stats
import os
from IPython import embed
from params import *
import datetime
import itertools
import pandas as pd
import helper_functions as hf
inch = 2.45
save_path = '../../thesis/Figures/Methods/'
# color2 = ['#f39c12', '#d35400', '#f8c471', '#dc7633', '#c0392b', '#f1c40f']
# fig, ax = plt.subplots(1, 1, figsize=(16 / inch, 5 / inch))
# fig.subplots_adjust(left=0.1, bottom=0.30, right=0.95, top=0.95)
#
# ax.plot([0,0.5,1,2], [1,1,1,1], '*', color=color2[0], label='Fish 1', markersize=7)
# ax.plot([0,1,1.5,2], [2,2,2,2], '*', color=color2[1], label='Fish 2', markersize=7)
#
# ax.set_ylim(0.5,2.5)
# ax.set_xlim(-0.2,2.7)
# ax.set_xticks([0,1,2])
# ax.set_yticks([1,2])
# ax.set_yticklabels([700,720])
# ax.set_xlabel('Time', fontsize=fs)
# ax.set_ylabel('Frequency', fontsize=fs)
# ax.make_nice_ax()
# ax.legend(loc='upper right')
#
# # fig.savefig(save_path+'till_data_structure.png')
# fig.savefig(save_path + 'till_data_structure.pdf')
#
# plt.show()
x1 = [2.5, 5]
y1 = [1, 1]
x2 = [2.5, 4]
y2 = [1.2, 1.2]
x3 = [1,3]
y3 = [2.5,2.5]
x4 = [1,1.5]
y4 = [1.7,1.7]
#
fig1, [ax1,ax2,ax3] = plt.subplots(3, 1, figsize=(16 / inch, 10 / inch))
fig1.subplots_adjust(left=0.1, bottom=0.1, right=0.85, top=0.95)
ax2.plot(x1,y1, '-', color=color2[0], label='Fish 1', linewidth=2, markersize=7)
ax2.plot(x2,y2, '-', color=color2[1], label='ID 2', linewidth=2, markersize=7)
ax2.plot(x3,y3, '-', color=color2[4], label='ID 3', linewidth=2, markersize=7)
ax2.plot(x4,y4, '-', color='gray', label='ID 4', linewidth=2, markersize=7)
ax1.plot(x1,y1, '-', color=color2[0], linewidth=2, markersize=7)
ax1.plot(x2,y2, '-', color=color2[1], linewidth=2, markersize=7)
ax1.plot(x3,y3, '-', color=color2[4], linewidth=2, markersize=7)
ax1.plot(x4,y4, '-', color='gray', linewidth=2, markersize=7)
ax3.plot(x1,y1, '-', color=color2[0], linewidth=2, markersize=7)
ax3.plot(x2,y2, '-', color=color2[1], linewidth=2, markersize=7)
ax3.plot(x3,y3, '-', color='gray', linewidth=2, markersize=7)
ax3.plot([2.5, 4], y1, 'o', color=color2[0], linewidth=2, markersize=7)
ax3.plot(x2,y2, 'o', color=color2[1], linewidth=2, markersize=7)
ax3.plot([2.5, 3], y3, 'o', color='gray', linewidth=2, markersize=7)
ax1.vlines(2.2, ymin=0, ymax=5.5, color='k', linestyle='dashed')
ax1.vlines(5.3, ymin=0, ymax=5.5, color='k', linestyle='dashed')
ax1.plot([2.2,2.5], [0.8,0.8],'k', linestyle='dotted')
ax1.plot([5.0,5.3], [0.8,0.8],'k', linestyle='dotted')
ax2.axvspan(2.2, 2.8, color=color2[0], alpha=0.1)
ax2.axvspan(2.2, 2.8, color=color2[1], alpha=0.1)
ax2.axvspan(2.2, 2.8, color=color2[4], alpha=0.1)
ax2.axvspan(3.7, 4.3, color=color2[1], alpha=0.1)
ax2.axvspan(2.7, 3.3, color=color2[4], alpha=0.1)
ax3.hlines(0.6, xmin=0, xmax=5.5, color='k', linestyle='dashed')
ax3.hlines(1.4, xmin=0, xmax=5.5, color='k', linestyle='dashed')
# ax3.vlines(3.7, ymin=0.8, ymax=1.2, color='k')
# ax3.vlines(4.3, ymin=0.8, ymax=1.2, color='k')
# ax3.hlines(0.8, ymin=2.3, ymax=2.7, color='k')
# ax3.hlines(3.3, ymin=2.3, ymax=2.7, color='k')
# ax3.plot([2.2,2.8], [1.2,1.2],'k')
# ax3.plot([3.7,4.3], [1.2,1.2],'k')
# ax3.plot([2.7,3.3], [2.7,2.7],'k')
# ax3.plot([2.2,2.8], [0.8,0.8],'k')
# ax3.plot([3.7,4.3], [0.8,0.8],'k')
# ax3.plot([2.7,3.3], [2.3,2.3],'k')
for idx, ax in enumerate([ax1,ax2,ax3]):
ax.text(-0.09, 1, chr(ord('A') + idx), transform=ax.transAxes, fontsize='large')
ax.set_ylim(0,3.5)
ax.set_xlim(0.5,5.5)
ax.set_yticks([])
ax.set_xticks([])
# ax.set_xticklabels([])
# ax.set_yticklabels([])
ax.set_xlabel('Time', fontsize=fs)
ax.set_ylabel('EODf', fontsize=fs)
ax.make_nice_ax()
ax = plt.gca()
ax2.legend(loc='center right', bbox_to_anchor=(1.2, 0.5))
# fig1.savefig(save_path + 'connect_ID.png')
fig1.savefig(save_path + 'connect_ID.pdf')
plt.show()
exit()
# temperatur
t = []
for index, filename_idx in enumerate([1, 4, 6]):
filename = sorted(os.listdir('../../../data/'))[filename_idx]
temp = pd.read_csv('../../../data/' + filename + '/temperatures.csv', sep=';')
t.append(np.array(temp.values.tolist())[:,1])
print(np.mean(np.hstack(t)))
print(np.min(np.hstack(t)))
print(np.max(np.hstack(t)))