Jan Grewe vor 1 Jahr
Ursprung
Commit
d51bb8ac92
1 geänderte Dateien mit 19 neuen und 18 gelöschten Zeilen
  1. 19 18
      code/plots/property_correlations.py

+ 19 - 18
code/plots/property_correlations.py

@@ -8,10 +8,11 @@ import scipy.stats as stats
 import matplotlib.pyplot as plt
 import matplotlib.image as mpimg
 import matplotlib.gridspec as gridspec
+
 from matplotlib.ticker import FormatStrFormatter
 
 from .figure_style import *
-
+label_size = 8
 fig2_help="Plots the properties of the baseline response and the stimulus driven response as a function of the receptive field position along the fish's rostro-caudal axis. Depends on fishsketch.png (expected in the folder ../figures/) and the data files "
 
 
@@ -113,7 +114,7 @@ def plot_baseline_properties(axes, df, markersize, correctionFactor):
     ax.set_xlim([0, 1.])
     ax.set_xticks(np.arange(0, 1.01, 0.1), minor=True)
     ax.set_xticklabels([])
-    ax.set_ylabel("# of cells", fontsize=8)
+    ax.set_ylabel("# of cells", fontsize=label_size)
     ax.set_ylim([0, 60])
     ax.set_yticks([0, 20, 40])
     ax.set_yticks([0, 10, 20, 30, 40], minor=True)
@@ -126,7 +127,7 @@ def plot_baseline_properties(axes, df, markersize, correctionFactor):
     plotMeanProperty(ax, posBins, xPositions, y_values)
     plotLinregress(ax, xPositions, y_values, bonferroni_factor=correctionFactor, feature="firing rate")
     ax.scatter(xPositions, y_values, color="tab:blue", s=markersize)
-    ax.set_ylabel('firing rate [Hz]', fontsize=7)
+    ax.set_ylabel('firing rate [Hz]', fontsize=label_size)
     maxFR = np.ceil(df.firing_rate.max()/200)*200
     ax.set_ylim(0, maxFR)
     ax.set_yticks(np.arange(0, maxFR+1, 200))
@@ -144,7 +145,7 @@ def plot_baseline_properties(axes, df, markersize, correctionFactor):
     plotMeanProperty(ax, posBins, xPositions, y_values)
     plotLinregress(ax, xPositions, y_values, bonferroni_factor=correctionFactor, feature="CV")
     ax.scatter(xPositions, y_values, color="tab:blue", s=markersize)
-    ax.set_ylabel(r'CV$_{ISI}$', fontsize=7)
+    ax.set_ylabel(r'CV$_{ISI}$', fontsize=label_size)
     ax.set_ylim(0, 1.5)
     ax.set_yticks(np.arange(0, 1.51, 0.5))
     ax.set_yticks(np.arange(0, 1.51, 0.25), minor=True)
@@ -161,7 +162,7 @@ def plot_baseline_properties(axes, df, markersize, correctionFactor):
     plotMeanProperty(ax, posBins, xPositions, y_values)
     plotLinregress(ax, xPositions, y_values, bonferroni_factor=correctionFactor, feature="burst fraction")
     ax.scatter(xPositions, y_values, color="tab:blue", s=markersize)
-    ax.set_ylabel('burst fraction', fontsize=7)
+    ax.set_ylabel('burst fraction', fontsize=label_size)
     ax.set_ylim(0, 1.0)
     ax.set_yticks(np.arange(0, 1.01, 0.5))
     ax.set_yticks(np.arange(0, 1.01, 0.25), minor=True)
@@ -177,7 +178,7 @@ def plot_baseline_properties(axes, df, markersize, correctionFactor):
     plotMeanProperty(ax, posBins, xPositions, y_values)
     plotLinregress(ax, xPositions, y_values, bonferroni_factor=correctionFactor, feature="vector strength")
     ax.scatter(xPositions, y_values, color="tab:blue", s=markersize)
-    ax.set_ylabel('vector strength', fontsize=7)
+    ax.set_ylabel('vector strength', fontsize=label_size)
     ax.yaxis.set_label_coords(-0.15, 0.5)
     ax.set_ylim(0.6, 1.0)
     ax.set_yticks(np.arange(0.6, 1.01, 0.2))
@@ -185,7 +186,7 @@ def plot_baseline_properties(axes, df, markersize, correctionFactor):
     ax.set_xlim([0, 1.0])
     ax.set_xticks(np.arange(0.0, 1.01, 0.2))
     ax.set_xticks(np.arange(0.0, 1.0, 0.1), minor=True)
-    ax.set_xlabel("receptor position [rel.]", fontsize=7)
+    ax.set_xlabel("receptor position [rel.]", fontsize=label_size+1)
     ax.xaxis.set_label_coords(0.5, -0.35)
 
 
@@ -205,7 +206,7 @@ def plot_driven_properties(axes, df, markersize, correctionFactor):
     ax.set_ylim([0, 300])
     ax.set_yticks(np.arange(0, 301, 100))
     ax.set_yticks(np.arange(0, 300, 50), minor=True)
-    ax.set_ylabel("modulation [Hz]", fontsize=7)
+    ax.set_ylabel("modulation [Hz]", fontsize=label_size)
     ax.yaxis.set_label_coords(-0.15, 0.5)
 
     # response variability
@@ -220,7 +221,7 @@ def plot_driven_properties(axes, df, markersize, correctionFactor):
     ax.set_ylim([0, 300])
     ax.set_yticks(np.arange(0, 301, 100))
     ax.set_yticks(np.arange(0, 300, 50), minor=True)
-    ax.set_ylabel("variability [Hz]", fontsize=7)
+    ax.set_ylabel("variability [Hz]", fontsize=label_size)
     ax.yaxis.set_label_coords(-0.15, 0.5)
 
     # lower and upper cutoff
@@ -237,7 +238,7 @@ def plot_driven_properties(axes, df, markersize, correctionFactor):
     ax.set_ylim([0, 325])
     ax.set_yticks(np.arange(0, 301, 100))
     ax.set_yticks(np.arange(0, 300, 50), minor=True)
-    ax.set_ylabel("cutoff [Hz]", fontsize=7)
+    ax.set_ylabel("cutoff [Hz]", fontsize=label_size)
     ax.yaxis.set_label_coords(-0.15, 0.5)
 
     # maximum gain
@@ -252,7 +253,7 @@ def plot_driven_properties(axes, df, markersize, correctionFactor):
     ax.set_ylim([0, 4])
     ax.set_yticks(np.arange(0, 4.1, 2))
     ax.set_yticks(np.arange(0, 4.1, 1), minor=True)
-    ax.set_ylabel("gain [kHz/mV]", fontsize=7)
+    ax.set_ylabel("gain [kHz/mV]", fontsize=label_size)
     ax.yaxis.set_label_coords(-0.15, 0.5)
     ax.yaxis.set_major_formatter(FormatStrFormatter('%.1f'))
 
@@ -267,8 +268,8 @@ def plot_driven_properties(axes, df, markersize, correctionFactor):
     ax.set_ylim([0, 600])
     ax.set_yticks(np.arange(0, 601, 200))
     ax.set_yticks(np.arange(0, 601, 100), minor=True)
-    ax.set_ylabel("mutual info. [bit/s]", fontsize=7)
-    ax.set_xlabel("receptor position [rel.]", fontsize=7)
+    ax.set_ylabel("mutual info. [bit/s]", fontsize=label_size)
+    ax.set_xlabel("receptor position [rel.]", fontsize=label_size+1)
     ax.yaxis.set_label_coords(-0.15, 0.5)
     ax.yaxis.set_major_formatter(FormatStrFormatter('%i'))
     ax.xaxis.set_label_coords(0.5, -0.35)
@@ -282,9 +283,9 @@ def layout_figure():
     driven_axes = list(range(len(baseline_subfig_labels)))
     baseline_axes = list(range(len(driven_subfig_labels)))
 
-    fig = plt.figure(figsize=(5.7, 5.5))
+    fig = plt.figure(figsize=(5.1, 5.75))
     subfigs = fig.subfigures(1, 2, wspace=0.05)
-    gr = gridspec.GridSpec(subplots_per_col, 1, hspace=0.5)
+    gr = gridspec.GridSpec(subplots_per_col, 1, hspace=0.5, left=0.225)
 
     for i in range(subplots_per_col):
         baseline_label = baseline_subfig_labels[i]
@@ -292,14 +293,14 @@ def layout_figure():
         baseline_axes[i] = subfigs[0].add_subplot(gr[i, 0])
         driven_axes[i] = subfigs[1].add_subplot(gr[i, 0])
 
-        baseline_axes[i].text(-0.225, 1.05, baseline_label, fontsize=subfig_labelsize, fontweight=subfig_labelweight, 
+        baseline_axes[i].text(-0.25, 1.05, baseline_label, fontsize=subfig_labelsize, fontweight=subfig_labelweight, 
                               transform=baseline_axes[i].transAxes, ha="center", va="bottom")
-        driven_axes[i].text(-0.225, 1.05, driven_label, fontsize=subfig_labelsize, fontweight=subfig_labelweight, 
+        driven_axes[i].text(-0.25, 1.05, driven_label, fontsize=subfig_labelsize, fontweight=subfig_labelweight, 
                               transform=driven_axes[i].transAxes, ha="center", va="bottom")
         despine(baseline_axes[i], ["top", "right"], False)
         despine(driven_axes[i], ["top", "right"], False)
 
-    pic_ax = subfigs[0].add_axes((0.095, 0.88, 1.0, 0.155))
+    pic_ax = subfigs[0].add_axes((0.23, 0.88, 0.75, 0.15))
     if os.path.exists("figures/fishsketch.png"):
         img = mpimg.imread("figures/fishsketch.png")
         pic_ax.imshow(img)