From 06ee27742c566119c9acf14f55a1788e2d12ba6c Mon Sep 17 00:00:00 2001
From: Nikolai Hartmann <Nikolai.Hartmann@physik.uni-muenchen.de>
Date: Fri, 3 Aug 2018 15:30:32 +0200
Subject: [PATCH] fix orientation of profile hist

---
 plotting.py                   | 5 +++--
 scripts/plot_single_neuron.py | 1 +
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/plotting.py b/plotting.py
index 6e83a8f..f579362 100644
--- a/plotting.py
+++ b/plotting.py
@@ -223,7 +223,7 @@ def plot_hist_2D(plotname, xedges, yedges, hist, varx_label=None, vary_label=Non
 
     extraopts = dict()
     if log:
-        extraopts.update(norm=matplotlib.colors.LogNorm(vmin=1, vmax=np.max(hist)))
+        extraopts.update(norm=matplotlib.colors.LogNorm(vmin=np.min(hist[hist>0]), vmax=np.max(hist)))
 
     ax.set_facecolor("black")
     pcm = ax.pcolormesh(X, Y, hist, cmap="inferno", **extraopts)
@@ -297,7 +297,7 @@ def plot_profile_2D(plotname, valsx, valsy, scores,
     hist = []
     for binindex_x in range(1, len(xedges)+1):
         line = []
-        for binindex_y in range(1, len(xedges)+1):
+        for binindex_y in range(1, len(yedges)+1):
             binindices_xy = (binindices_x == binindex_x) & (binindices_y == binindex_y)
             scores_bin = scores[binindices_xy]
             if len(scores_bin) > 0:
@@ -310,6 +310,7 @@ def plot_profile_2D(plotname, valsx, valsy, scores,
             line.append(prof_score)
         hist.append(line)
     hist = np.array(hist)
+    hist = hist.T # had a list of columns - needs to be list of rows
 
     plot_hist_2D(plotname, xedges, yedges, hist, **kwargs)
 
diff --git a/scripts/plot_single_neuron.py b/scripts/plot_single_neuron.py
index bb638d8..6f12819 100755
--- a/scripts/plot_single_neuron.py
+++ b/scripts/plot_single_neuron.py
@@ -132,4 +132,5 @@ elif args.mode.startswith("hist"):
         ymin=vary_range[0], ymax=vary_range[1], nbinsy=vary_range[2],
         weights=weights,
         varx_label=varx_label, vary_label=vary_label,
+        log=args.log,
     )
-- 
GitLab