adding subplots cm

This commit is contained in:
wendtalexander 2023-01-25 13:44:14 +01:00
parent 798884fd01
commit 08c7913c95
6 changed files with 124 additions and 115 deletions

View File

@ -173,13 +173,15 @@ def main(datapath: str):
size_winners = [] size_winners = []
for l in ['l1', 'l2', 'l3']: for l in ['l1', 'l2', 'l3']:
size_winner = size_rows[size_rows['fish']== winner_fish1][l].values[0] size_winner = size_rows[size_rows['fish']
== winner_fish1][l].values[0]
size_winners.append(size_winner) size_winners.append(size_winner)
mean_size_winner = np.nanmean(size_winners) mean_size_winner = np.nanmean(size_winners)
size_losers = [] size_losers = []
for l in ['l1', 'l2', 'l3']: for l in ['l1', 'l2', 'l3']:
size_loser = size_rows[size_rows['fish']== winner_fish2][l].values[0] size_loser = size_rows[size_rows['fish']
== winner_fish2][l].values[0]
size_losers.append(size_loser) size_losers.append(size_loser)
mean_size_loser = np.nanmean(size_losers) mean_size_loser = np.nanmean(size_losers)
@ -191,13 +193,15 @@ def main(datapath: str):
size_winners = [] size_winners = []
for l in ['l1', 'l2', 'l3']: for l in ['l1', 'l2', 'l3']:
size_winner = size_rows[size_rows['fish']== winner_fish2][l].values[0] size_winner = size_rows[size_rows['fish']
== winner_fish2][l].values[0]
size_winners.append(size_winner) size_winners.append(size_winner)
mean_size_winner = np.nanmean(size_winners) mean_size_winner = np.nanmean(size_winners)
size_losers = [] size_losers = []
for l in ['l1', 'l2', 'l3']: for l in ['l1', 'l2', 'l3']:
size_loser = size_rows[size_rows['fish']== winner_fish1][l].values[0] size_loser = size_rows[size_rows['fish']
== winner_fish1][l].values[0]
size_losers.append(size_loser) size_losers.append(size_loser)
mean_size_loser = np.nanmean(size_losers) mean_size_loser = np.nanmean(size_losers)
@ -219,7 +223,8 @@ def main(datapath: str):
size_chirps_diffs.append(chirp_winner - chirp_loser) size_chirps_diffs.append(chirp_winner - chirp_loser)
freq_diffs.append(freq_winner - freq_loser) freq_diffs.append(freq_winner - freq_loser)
fig, (ax1, ax2, ax3) = plt.subplots(1, 3, figsize=(10, 5)) fig, (ax1, ax2, ax3) = plt.subplots(1, 3, figsize=(22*ps.cm, 12*ps.cm), width_ratios=[1.5, 1,1])
plt.subplots_adjust(left=0.098, right=0.945, top=0.94, wspace=0.343)
scatterwinner = 1.15 scatterwinner = 1.15
scatterloser = 1.85 scatterloser = 1.85
chirps_winner = np.asarray(chirps_winner)[~np.isnan(chirps_winner)] chirps_winner = np.asarray(chirps_winner)[~np.isnan(chirps_winner)]
@ -234,24 +239,24 @@ def main(datapath: str):
ax1.scatter(np.ones(len(chirps_loser)) * ax1.scatter(np.ones(len(chirps_loser)) *
scatterloser, chirps_loser, color='r') scatterloser, chirps_loser, color='r')
ax1.set_xticklabels(['winner', 'loser']) ax1.set_xticklabels(['winner', 'loser'])
ax1.text(0.9, 0.9, f'n = {len(chirps_winner)}', ax1.text(0.1, 0.9, f'n = {len(chirps_winner)}',
transform=ax1.transAxes, color=ps.white) transform=ax1.transAxes, color=ps.white)
for w, l in zip(chirps_winner, chirps_loser): for w, l in zip(chirps_winner, chirps_loser):
ax1.plot([scatterwinner, scatterloser], [w, l], ax1.plot([scatterwinner, scatterloser], [w, l],
color='r', alpha=0.5, linewidth=0.5) color='r', alpha=0.5, linewidth=0.5)
ax1.set_ylabel('Chirps [n]', color=ps.white)
colors1 = ps.red colors1 = ps.red
ps.set_boxplot_color(bplot1, colors1) ps.set_boxplot_color(bplot1, colors1)
colors1 = ps.orange colors1 = ps.orange
ps.set_boxplot_color(bplot2, colors1) ps.set_boxplot_color(bplot2, colors1)
ax1.set_ylabel('Chirpscounts [n]')
embed()
ax2.scatter(size_diffs, size_chirps_diffs, color='r') ax2.scatter(size_diffs, size_chirps_diffs, color='r')
ax2.set_xlabel('Size difference [mm]') ax2.set_xlabel('Size difference [mm]')
ax2.set_ylabel('Chirps difference [n]') ax2.set_ylabel('Chirps difference [n]')
ax3.scatter(freq_diffs, freq_chirps_diffs, color='r') ax3.scatter(freq_diffs, size_chirps_diffs, color='r')
# ax3.scatter(freq_diffs, freq_chirps_diffs, color='r')
ax3.set_xlabel('Frequency difference [Hz]') ax3.set_xlabel('Frequency difference [Hz]')
ax3.set_yticklabels([]) ax3.set_yticklabels([])
ax3.set ax3.set

View File

@ -20,13 +20,13 @@ logger = makeLogger(__name__)
def main(datapath: str): def main(datapath: str):
foldernames = [datapath + x + '/' for x in os.listdir(datapath) if os.path.isdir(datapath+x)] foldernames = [datapath + x + '/' for x in os.listdir(datapath) if os.path.isdir(datapath+x)]
#for foldername in foldernames: for foldername in foldernames:
foldername = foldernames[0] #foldername = foldernames[0]
# if foldername == '../data/mount_data/2020-05-12-10_00/': if foldername == '../data/mount_data/2020-05-12-10_00/':
# continue continue
#behabvior is pandas dataframe with all the data #behabvior is pandas dataframe with all the data
bh = Behavior(foldername) bh = Behavior(foldername)
#2020-06-11-10
category = bh.behavior category = bh.behavior
timestamps = bh.start_s timestamps = bh.start_s
# Correct for doubles in chasing on- and offsets to get the right on-/offset pairs # Correct for doubles in chasing on- and offsets to get the right on-/offset pairs
@ -47,7 +47,7 @@ def main(datapath: str):
fish1_color = ps.red fish1_color = ps.red
fish2_color = ps.orange fish2_color = ps.orange
fig, ax = plt.subplots(4, 1, figsize=(28*ps.cm, 13*ps.cm), height_ratios=[0.5, 0.5, 0.5, 6], sharex=True) fig, ax = plt.subplots(4, 1, figsize=(21*ps.cm, 13*ps.cm), height_ratios=[0.5, 0.5, 0.5, 6], sharex=True)
# marker size # marker size
s = 200 s = 200
ax[0].scatter(physical_contact, np.ones(len(physical_contact)), color='firebrick', marker='|', s=s) ax[0].scatter(physical_contact, np.ones(len(physical_contact)), color='firebrick', marker='|', s=s)
@ -92,16 +92,17 @@ def main(datapath: str):
ax[3].set_xticks(np.arange(0, 6.1, 0.5)) ax[3].set_xticks(np.arange(0, 6.1, 0.5))
labelpad = 40 labelpad = 40
ax[0].set_ylabel('Physical contact', rotation=0, labelpad=labelpad) fsize = 12
ax[1].set_ylabel('Chasing events', rotation=0, labelpad=labelpad) ax[0].set_ylabel('Physical contact', rotation=0, labelpad=labelpad, fontsize=fsize)
ax[2].set_ylabel('Chirps', rotation=0, labelpad=labelpad) ax[1].set_ylabel('Chasing events', rotation=0, labelpad=labelpad, fontsize=fsize)
ax[2].set_ylabel('Chirps', rotation=0, labelpad=labelpad, fontsize=fsize)
ax[3].set_ylabel('EODf') ax[3].set_ylabel('EODf')
ax[3].set_xlabel('Time [h]') ax[3].set_xlabel('Time [h]')
#ax[0].set_title(foldername.split('/')[-2]) ax[0].set_title(foldername.split('/')[-2])
# 2020-03-31-9_59 # 2020-03-31-9_59
plt.subplots_adjust(left=0.13, right=0.987, top=0.97) plt.subplots_adjust(left=0.158, right=0.987, top=0.918)
plt.savefig('../poster/figs/timeline.pdf') #plt.savefig('../poster/figs/timeline.pdf')
plt.show() plt.show()

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -21,10 +21,10 @@ blockverticalspace=2mm, colspace=20mm, subcolspace=0mm]{tikzposter} %Default val
sender identification of freely interacting individuals impossible. sender identification of freely interacting individuals impossible.
This profoundly limits our current understanding of chirps to experiments This profoundly limits our current understanding of chirps to experiments
with single - or physically separated - individuals. with single - or physically separated - individuals.
% \begin{tikzfigure}[] \begin{tikzfigure}[]
% \label{griddrawing} \label{griddrawing}
% \includegraphics[width=1\linewidth]{figs/introplot} \includegraphics[width=0.8\linewidth]{figs/introplot}
% \end{tikzfigure} \end{tikzfigure}
} }
\myblock[TranspBlock]{Chirp detection}{ \myblock[TranspBlock]{Chirp detection}{
\begin{tikzfigure}[] \begin{tikzfigure}[]
@ -41,11 +41,26 @@ blockverticalspace=2mm, colspace=20mm, subcolspace=0mm]{tikzposter} %Default val
\includegraphics[width=\linewidth]{figs/timeline.pdf} \includegraphics[width=\linewidth]{figs/timeline.pdf}
\end{tikzfigure} \end{tikzfigure}
\noindent \noindent
\begin{itemize}
\setlength\itemsep{0.5em}
\item Two fish compete for one hidding place in one tank,
\item Experiment had a 3 hour long darkphase and a 3 hour long light phase.
\end{itemize}
\noindent
\begin{minipage}[c]{0.7\linewidth}
\begin{tikzfigure}[] \begin{tikzfigure}[]
\label{fig:example_b} \label{fig:example_b}
\includegraphics[width=\linewidth]{figs/chirps_winner_loser.pdf} \includegraphics[width=\linewidth]{figs/chirps_winner_loser.pdf}
\end{tikzfigure} \end{tikzfigure}
\noindent \end{minipage} % no space if you would like to put them side by side
\begin{minipage}[c]{0.2\linewidth}
\begin{itemize}
\setlength\itemsep{0.5em}
\item Fish who won the competition chirped more often than the fish who lost.
\item
\end{itemize}
\end{minipage}
} }
\myblock[TranspBlock]{Interactions at modulations}{ \myblock[TranspBlock]{Interactions at modulations}{
@ -55,19 +70,7 @@ blockverticalspace=2mm, colspace=20mm, subcolspace=0mm]{tikzposter} %Default val
\includegraphics[width=0.5\linewidth]{example-image-c} \includegraphics[width=0.5\linewidth]{example-image-c}
\end{tikzfigure} \end{tikzfigure}
\begin{multicols}{2}
\begin{itemize}
\setlength\itemsep{0.5em}
\item $\Delta$EOD$f$ does not appear to decrease during synchronous modulations ().
\item Individuals that rise their EOD$f$ first appear to rise their frequency higher compared to reactors (\textbf{B}).
\vfill
\null
\columnbreak
\item Synchronized fish keep distances below 1 m (\textbf{C}) but distances over 3 m also occur (see \textbf{movie}).
\item Spatial interactions increase \textbf{after} the start of a synchronous modulation (\textbf{D}).
\end{itemize}
\end{multicols}
\vspace{-1cm}
} }
\myblock[GrayBlock]{Conclusion}{ \myblock[GrayBlock]{Conclusion}{