finished plot in chasing
This commit is contained in:
parent
238e36434d
commit
a32d91309f
@ -110,7 +110,7 @@ def PlotStyle() -> None:
|
||||
plt.setp(bp["boxes"], color=color)
|
||||
plt.setp(bp["whiskers"], color=white)
|
||||
plt.setp(bp["caps"], color=white)
|
||||
plt.setp(bp["medians"], color=white)
|
||||
plt.setp(bp["medians"], color=black)
|
||||
|
||||
|
||||
@classmethod
|
||||
@ -255,10 +255,10 @@ def PlotStyle() -> None:
|
||||
plt.rcParams["boxplot.boxprops.color"] = gray
|
||||
plt.rcParams["boxplot.whiskerprops.color"] = gray
|
||||
plt.rcParams["boxplot.capprops.color"] = gray
|
||||
plt.rcParams["boxplot.medianprops.color"] = gray
|
||||
plt.rcParams["boxplot.medianprops.color"] = black
|
||||
plt.rcParams["text.color"] = white
|
||||
plt.rcParams["axes.facecolor"] = black # axes background color
|
||||
plt.rcParams["axes.edgecolor"] = gray # axes edge color
|
||||
plt.rcParams["axes.edgecolor"] = white # axes edge color
|
||||
# plt.rcParams["axes.grid"] = True # display grid or not
|
||||
# plt.rcParams["axes.grid.axis"] = "y" # which axis the grid is applied to
|
||||
plt.rcParams["axes.labelcolor"] = white
|
||||
@ -284,9 +284,9 @@ def PlotStyle() -> None:
|
||||
"#f5c2e7",
|
||||
],
|
||||
)
|
||||
plt.rcParams["xtick.color"] = gray # color of the ticks
|
||||
plt.rcParams["ytick.color"] = gray # color of the ticks
|
||||
plt.rcParams["grid.color"] = dark_gray # grid color
|
||||
plt.rcParams["xtick.color"] = white # color of the ticks
|
||||
plt.rcParams["ytick.color"] = white # color of the ticks
|
||||
plt.rcParams["grid.color"] = white # grid color
|
||||
plt.rcParams["figure.facecolor"] = black # figure face color
|
||||
plt.rcParams["figure.edgecolor"] = black # figure edge color
|
||||
plt.rcParams["savefig.facecolor"] = black # figure face color when saving
|
||||
|
@ -252,9 +252,9 @@ def main(datapath: str):
|
||||
size_loser_pearsonr = pearsonr(size_diffs_loser, size_chirps_loser)
|
||||
|
||||
fig, (ax1, ax2, ax3) = plt.subplots(1, 3, figsize=(
|
||||
21*ps.cm, 10*ps.cm), width_ratios=[1, 0.8, 0.8], sharey=True)
|
||||
plt.subplots_adjust(left=0.11, right=0.948, top=0.905,
|
||||
wspace=0.343, bottom=0.145)
|
||||
21*ps.cm, 8*ps.cm), width_ratios=[1, 0.8, 0.8], sharey=True)
|
||||
plt.subplots_adjust(left=0.11, right=0.948, top=0.86,
|
||||
wspace=0.343, bottom=0.18)
|
||||
scatterwinner = 1.15
|
||||
scatterloser = 1.85
|
||||
chirps_winner = np.asarray(chirps_winner)[~np.isnan(chirps_winner)]
|
||||
@ -262,47 +262,51 @@ def main(datapath: str):
|
||||
|
||||
stat = wilcoxon(chirps_winner, chirps_loser)
|
||||
print(stat)
|
||||
winner_color = ps.lavender
|
||||
loser_color = ps.purple
|
||||
|
||||
bplot1 = ax1.boxplot(chirps_winner, positions=[
|
||||
0.9], showfliers=False, patch_artist=True)
|
||||
|
||||
bplot2 = ax1.boxplot(chirps_loser, positions=[
|
||||
2.1], showfliers=False, patch_artist=True)
|
||||
|
||||
ax1.scatter(np.ones(len(chirps_winner)) *
|
||||
scatterwinner, chirps_winner, color=ps.red)
|
||||
scatterwinner, chirps_winner, color=winner_color)
|
||||
ax1.scatter(np.ones(len(chirps_loser)) *
|
||||
scatterloser, chirps_loser, color=ps.orange)
|
||||
ax1.set_xticklabels(['winner', 'loser'])
|
||||
scatterloser, chirps_loser, color=loser_color)
|
||||
ax1.set_xticklabels(['Winner', 'Loser'])
|
||||
|
||||
ax1.text(0.1, 0.95, f'n={len(chirps_winner)}', transform=ax1.transAxes, color=ps.white)
|
||||
ax1.text(0.1, 0.95, f'n={len(chirps_winner)}',
|
||||
transform=ax1.transAxes, color=ps.white)
|
||||
|
||||
for w, l in zip(chirps_winner, chirps_loser):
|
||||
ax1.plot([scatterwinner, scatterloser], [w, l],
|
||||
color=ps.white, alpha=1, linewidth=0.5)
|
||||
ax1.set_ylabel('chirpcounts', color=ps.white)
|
||||
ax1.set_xlabel('outcome', color=ps.white)
|
||||
color=ps.white, alpha=0.6, linewidth=1, zorder=-1)
|
||||
ax1.set_ylabel('Chirp counts', color=ps.white)
|
||||
ax1.set_xlabel('Competition outcome', color=ps.white)
|
||||
|
||||
colors1 = ps.red
|
||||
ps.set_boxplot_color(bplot1, colors1)
|
||||
colors1 = ps.orange
|
||||
ps.set_boxplot_color(bplot2, colors1)
|
||||
ps.set_boxplot_color(bplot1, winner_color)
|
||||
ps.set_boxplot_color(bplot2, loser_color)
|
||||
|
||||
ax2.scatter(size_diffs_winner, size_chirps_winner,
|
||||
color=ps.red, label=f'winner')
|
||||
color=winner_color, label=f'Winner')
|
||||
ax2.scatter(size_diffs_loser, size_chirps_loser,
|
||||
color=ps.orange, label='loser')
|
||||
color=loser_color, label='Loser')
|
||||
|
||||
ax2.text(0.05, 0.95, f'n={len(size_chirps_winner)}', transform=ax2.transAxes, color=ps.white)
|
||||
ax2.text(0.05, 0.95, f'n={len(size_chirps_winner)}',
|
||||
transform=ax2.transAxes, color=ps.white)
|
||||
|
||||
ax2.set_xlabel('size difference [cm]')
|
||||
ax2.set_xlabel('Size difference [cm]')
|
||||
# ax2.set_xticks(np.arange(-10, 10.1, 2))
|
||||
|
||||
ax3.scatter(freq_diffs_higher, freq_chirps_winner, color=ps.red)
|
||||
ax3.scatter(freq_diffs_lower, freq_chirps_loser, color=ps.orange)
|
||||
ax3.scatter(freq_diffs_higher, freq_chirps_winner, color=winner_color)
|
||||
ax3.scatter(freq_diffs_lower, freq_chirps_loser, color=loser_color)
|
||||
|
||||
ax3.text(0.1, 0.95, f'n={len(freq_chirps_loser)}', transform=ax3.transAxes, color=ps.white)
|
||||
ax3.text(0.1, 0.95, f'n={len(freq_chirps_loser)}',
|
||||
transform=ax3.transAxes, color=ps.white)
|
||||
|
||||
ax3.set_xlabel('absolute frequency [Hz]')
|
||||
ax3.set_xlabel('EODf [Hz]')
|
||||
handles, labels = ax2.get_legend_handles_labels()
|
||||
fig.legend(handles, labels, loc='upper center', ncol=2)
|
||||
# pearson r
|
||||
|
@ -45,33 +45,46 @@ def main(datapath: str):
|
||||
|
||||
chirps_in_chasings = []
|
||||
for onset, offset in zip(chasing_onset, chasing_offset):
|
||||
chirps_in_chasing = [c for c in bh.chirps if (c > onset) & (c < offset)]
|
||||
chirps_in_chasing = [
|
||||
c for c in bh.chirps if (c > onset) & (c < offset)]
|
||||
chirps_in_chasings.append(chirps_in_chasing)
|
||||
|
||||
try:
|
||||
time_chasing = np.sum(chasing_offset[chasing_offset<3*60*60] - chasing_onset[chasing_onset<3*60*60])
|
||||
time_chasing = np.sum(
|
||||
chasing_offset[chasing_offset < 3*60*60] - chasing_onset[chasing_onset < 3*60*60])
|
||||
except:
|
||||
time_chasing = np.sum(chasing_offset[chasing_offset<3*60*60] - chasing_onset[chasing_onset<3*60*60][:-1])
|
||||
|
||||
time_chasing = np.sum(
|
||||
chasing_offset[chasing_offset < 3*60*60] - chasing_onset[chasing_onset < 3*60*60][:-1])
|
||||
|
||||
time_chasing_percent = (time_chasing/(3*60*60))*100
|
||||
chirps_chasing = np.asarray(flatten(chirps_in_chasings))
|
||||
chirps_chasing_new = chirps_chasing[chirps_chasing<3*60*60]
|
||||
chirps_percent = (len(chirps_chasing_new)/len(bh.chirps[bh.chirps<3*60*60]))*100
|
||||
chirps_chasing_new = chirps_chasing[chirps_chasing < 3*60*60]
|
||||
chirps_percent = (len(chirps_chasing_new) /
|
||||
len(bh.chirps[bh.chirps < 3*60*60]))*100
|
||||
|
||||
time_precents.append(time_chasing_percent)
|
||||
chirps_percents.append(chirps_percent)
|
||||
|
||||
fig, ax = plt.subplots(1, 1, figsize=(14*ps.cm, 10*ps.cm))
|
||||
|
||||
ax.boxplot([time_precents, chirps_percents])
|
||||
ax.set_xticklabels(['Time Chasing', 'Chirps in Chasing'])
|
||||
fig, ax = plt.subplots(1, 1, figsize=(7*ps.cm, 7*ps.cm))
|
||||
scatter_time = 1.20
|
||||
scatter_chirps = 1.80
|
||||
size = 10
|
||||
bplot1 = ax.boxplot([time_precents, chirps_percents],
|
||||
showfliers=False, patch_artist=True)
|
||||
ps.set_boxplot_color(bplot1, ps.gray)
|
||||
ax.set_xticklabels(['Time \nChasing', 'Chirps \nin Chasing'])
|
||||
ax.set_ylabel('Percent')
|
||||
ax.scatter(np.ones(len(time_precents))*1.25, time_precents, color=ps.white)
|
||||
ax.scatter(np.ones(len(chirps_percents))*1.75, chirps_percents, color=ps.white)
|
||||
ax.scatter(np.ones(len(time_precents))*scatter_time, time_precents,
|
||||
facecolor=ps.white, s=size)
|
||||
ax.scatter(np.ones(len(chirps_percents))*scatter_chirps, chirps_percents,
|
||||
facecolor=ps.white, s=size)
|
||||
|
||||
for i in range(len(time_precents)):
|
||||
ax.plot([1.25, 1.75], [time_precents[i], chirps_percents[i]], color=ps.white)
|
||||
ax.text(0.99, 0.99, f'{len(time_precents)} fish', transform=ax.transAxes)
|
||||
ax.plot([scatter_time, scatter_chirps], [time_precents[i],
|
||||
chirps_percents[i]], alpha=0.6, linewidth=1, color=ps.white)
|
||||
|
||||
ax.text(0.1, 0.9, f'n={len(time_precents)}', transform=ax.transAxes)
|
||||
plt.subplots_adjust(left=0.221, bottom=0.186, right=0.97, top=0.967)
|
||||
plt.savefig('../poster/figs/chirps_in_chasing.pdf')
|
||||
plt.show()
|
||||
|
||||
@ -80,5 +93,3 @@ if __name__ == '__main__':
|
||||
# Path to the data
|
||||
datapath = '../data/mount_data/'
|
||||
main(datapath)
|
||||
|
||||
|
||||
|
@ -79,7 +79,6 @@ def main(datapath: str):
|
||||
ax[0].set_xticks([])
|
||||
ax[0].set_yticks([])
|
||||
ps.hide_ax(ax[0])
|
||||
ax[0].yaxis.set_label_coords(-0.1, 0.5)
|
||||
|
||||
ax[1].grid(False)
|
||||
ax[1].set_frame_on(False)
|
||||
@ -99,19 +98,23 @@ def main(datapath: str):
|
||||
|
||||
labelpad = 30
|
||||
fsize = 12
|
||||
ax[0].set_ylabel('contact', rotation=0,
|
||||
|
||||
ax[0].set_ylabel('Contact', rotation=0,
|
||||
labelpad=labelpad, fontsize=fsize)
|
||||
ax[1].set_ylabel('chasing', rotation=0,
|
||||
ax[0].yaxis.set_label_coords(-0.062, -0.08)
|
||||
ax[1].set_ylabel('Chasing', rotation=0,
|
||||
labelpad=labelpad, fontsize=fsize)
|
||||
ax[2].set_ylabel('chirps', rotation=0,
|
||||
ax[1].yaxis.set_label_coords(-0.06, -0.08)
|
||||
ax[2].set_ylabel('Chirps', rotation=0,
|
||||
labelpad=labelpad, fontsize=fsize)
|
||||
ax[2].yaxis.set_label_coords(-0.07, -0.08)
|
||||
ax[4].set_ylabel('EODf')
|
||||
|
||||
ax[4].set_xlabel('time [h]')
|
||||
ax[4].set_xlabel('Time [h]')
|
||||
# ax[0].set_title(foldername.split('/')[-2])
|
||||
# 2020-03-31-9_59
|
||||
plt.subplots_adjust(left=0.158, right=0.987, top=0.918)
|
||||
# plt.savefig('../poster/figs/timeline.pdf')
|
||||
plt.subplots_adjust(left=0.158, right=0.987, top=0.918, bottom=0.136)
|
||||
plt.savefig('../poster/figs/timeline.pdf')
|
||||
plt.show()
|
||||
|
||||
# plot chirps
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
poster/main.pdf
BIN
poster/main.pdf
Binary file not shown.
@ -22,20 +22,20 @@ blockverticalspace=2mm, colspace=20mm, subcolspace=0mm]{tikzposter} %Default val
|
||||
weakly electric fish impossible. This profoundly limits our current
|
||||
understanding of chirps to experiments
|
||||
with single - or physically separated - individuals.
|
||||
% \begin{tikzfigure}[]
|
||||
% \label{griddrawing}
|
||||
% \includegraphics[width=0.8\linewidth]{figs/introplot}
|
||||
% \end{tikzfigure}
|
||||
\begin{tikzfigure}[]
|
||||
\label{griddrawing}
|
||||
\includegraphics[width=0.6\linewidth]{figs/introplot}
|
||||
\end{tikzfigure}
|
||||
}
|
||||
\myblock[TranspBlock]{Chirp detection}{
|
||||
\begin{tikzfigure}[]
|
||||
\label{fig:alg1}
|
||||
\includegraphics[width=0.9\linewidth]{figs/algorithm1}
|
||||
\includegraphics[width=0.6\linewidth]{figs/algorithm1}
|
||||
\end{tikzfigure}
|
||||
\vspace{2cm}
|
||||
\begin{tikzfigure}[]
|
||||
\label{fig:alg2}
|
||||
\includegraphics[width=1\linewidth]{figs/algorithm}
|
||||
\includegraphics[width=0.9\linewidth]{figs/algorithm}
|
||||
\end{tikzfigure}
|
||||
\vspace{0cm}
|
||||
}
|
||||
@ -63,8 +63,8 @@ blockverticalspace=2mm, colspace=20mm, subcolspace=0mm]{tikzposter} %Default val
|
||||
|
||||
\begin{itemize}
|
||||
\setlength\itemsep{0.5em}
|
||||
\item Fish who won the competition chirped more often than the fish who lost.
|
||||
\item
|
||||
\item Fish who lost the competition chirped more often than the fish who lost.
|
||||
\item Size has an effect on the Competition outcome, and the chirp count.
|
||||
\end{itemize}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user