diff --git a/notebooks/AGIPD/Characterize_AGIPD_Gain_FlatFields_NBC.ipynb b/notebooks/AGIPD/Characterize_AGIPD_Gain_FlatFields_NBC.ipynb
index b3a8fc651b6720d0946be226cd0a7d2689297b7b..6ef38779844fcbbb19adaee9122642876b0a99fa 100644
--- a/notebooks/AGIPD/Characterize_AGIPD_Gain_FlatFields_NBC.ipynb
+++ b/notebooks/AGIPD/Characterize_AGIPD_Gain_FlatFields_NBC.ipynb
@@ -14,8 +14,8 @@
    "metadata": {},
    "outputs": [],
    "source": [
-    " in_folder = \"/gpfs/exfel/exp/SPB/202030/p900138/scratch/karnem/r0203_r0204_v01/\" # the folder to read histograms from, required\n",
-    "out_folder = \"/gpfs/exfel/exp/SPB/202030/p900138/scratch/karnem/r0203_r0204_v01/\"  # the folder to output to, required\n",
+    "in_folder = \"/gpfs/exfel/exp/SPB/202030/p900138/scratch/karnem/r0203_r0204_v01/\" # the folder to read histograms from, required\n",
+    "out_folder = \"\"  # the folder to output to, required\n",
     "hist_file_template = \"hists_m{:02d}_sum.h5\" # the template to use to access histograms\n",
     "modules = [10] # modules to correct, set to -1 for all, range allowed\n",
     "\n",
@@ -376,38 +376,35 @@
    "metadata": {},
    "outputs": [],
    "source": [
-    "fig = plt.figure(figsize=(10,5))\n",
+    "fig, (ax1, ax2) = plt.subplots(1, 2)\n",
+    "fig.set_size_inches(16, 7)\n",
     "for i, shape in enumerate(shapes):\n",
     "    idx = shape[3]\n",
-    "    plt.errorbar(x[idx], hist[idx], np.sqrt(hist[idx]),\n",
-    "         marker='+', ls=''\n",
-    "         )\n",
+    "    ax1.errorbar(\n",
+    "        x[idx], hist[idx],\n",
+    "        np.sqrt(hist[idx]),\n",
+    "        marker='+', ls='',\n",
+    "    )\n",
     "    yg = gaussian(x[idx], *shape[:3])\n",
     "    l = f'Peak {i}: {shape[1]:0.1f} $ \\pm $ {shape[2]:0.2f} ADU'\n",
-    "    plt.plot(x[idx], yg, label=l)\n",
-    "plt.grid(True)\n",
-    "plt.xlabel(\"Signal [ADU]\")\n",
-    "plt.ylabel(\"Counts\")\n",
-    "plt.legend(ncol=2)\n",
+    "    ax1.plot(x[idx], yg, label=l)\n",
+    "ax1.grid(True)\n",
+    "ax1.set_xlabel(\"Signal [ADU]\")\n",
+    "ax1.set_ylabel(\"Counts\")\n",
+    "ax1.legend(ncol=2)\n",
     "\n",
-    "plt.show()"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": null,
-   "metadata": {},
-   "outputs": [],
-   "source": [
     "_ = xana.simplePlot(\n",
-    "    d, \n",
-    "    x_label='Signal [ADU]', \n",
+    "    d,\n",
+    "    use_axis=ax2,\n",
+    "    x_label='Signal [ADU]',\n",
     "    y_label='Counts',\n",
-    "    secondpanel=True, y_log=False, \n",
-    "    x_range=(frange[0], frange[1]), \n",
-    "    y_range=(1., np.max(hist)*1.6), \n",
-    "    legend='top-left-frame-ncol2'\n",
-    ")"
+    "    secondpanel=True, y_log=False,\n",
+    "    x_range=(frange[0], frange[1]),\n",
+    "    y_range=(1., np.max(hist)*1.6),\n",
+    "    legend='top-left-frame-ncol2',\n",
+    ")\n",
+    "\n",
+    "plt.show()"
    ]
   },
   {
@@ -500,33 +497,39 @@
    "metadata": {},
    "outputs": [],
    "source": [
-    "labels = ['Noise peak [ADU]',\n",
-    "         'First photon peak [ADU]',\n",
-    "         f\"gain [ADU/keV], $\\gamma$={photon_energy} [keV]\",\n",
-    "         \"$\\chi^2$/nDOF\",\n",
-    "         'Fraction of bad pixels']\n",
-    "for i, key in enumerate(['g0mean', 'g1mean', 'gain', 'chi2_ndof', 'mask']):\n",
+    "labels = [\n",
+    "    \"Noise peak [ADU]\",\n",
+    "    \"First photon peak [ADU]\",\n",
+    "    f\"gain [ADU/keV] $\\gamma$={photon_energy} [keV]\",\n",
+    "    \"$\\chi^2$/nDOF\",\n",
+    "    \"Fraction of bad pixels\",\n",
+    "]\n",
     "\n",
+    "for i, key in enumerate(['g0mean', 'g1mean', 'gain', 'chi2_ndof', 'mask']):\n",
     "    fig = plt.figure(figsize=(20,5))\n",
     "    ax = fig.add_subplot(121)\n",
     "    data = fit_result[key]\n",
     "    if key == 'mask':\n",
-    "        data = data>0\n",
+    "        data = data > 0\n",
     "        vmin, vmax = [0, 1]\n",
     "    else:\n",
     "        vmin, vmax = get_range(data, 5)\n",
-    "    _ = heatmapPlot(np.mean(data, axis=0).T,\n",
-    "                    add_panels=False, cmap='viridis', use_axis=ax,\n",
-    "                    vmin=vmin, vmax=vmax, lut_label=labels[i] )\n",
-    " \n",
+    "    _ = heatmapPlot(\n",
+    "        np.mean(data, axis=0).T,\n",
+    "        add_panels=False, cmap='viridis', use_axis=ax,\n",
+    "        vmin=vmin, vmax=vmax, lut_label=labels[i]\n",
+    "    )\n",
+    "\n",
     "    if key != 'mask':\n",
     "        vmin, vmax = get_range(data, 7)\n",
-    "        ax1 = fig.add_subplot(122)\n",
-    "        _ = xana.histPlot(ax1,data.flatten(), \n",
-    "                      bins=45,range=[vmin, vmax],\n",
-    "                      log=True,color='red',histtype='stepfilled')\n",
-    "        plt.xlabel(labels[i])\n",
-    "        plt.ylabel(\"Counts\")   "
+    "        ax = fig.add_subplot(122)\n",
+    "        _ = xana.histPlot(\n",
+    "            ax, data.flatten(),\n",
+    "            bins=45,range=[vmin, vmax],\n",
+    "            log=True,color='red',histtype='stepfilled'\n",
+    "        )\n",
+    "        ax.set_xlabel(labels[i])\n",
+    "        ax.set_ylabel(\"Counts\")"
    ]
   },
   {
@@ -551,7 +554,7 @@
     "ax.set_title(f'{hist_std[hist_std<intensity_lim].shape[0]} histograms below threshold in {intensity_lim} ADU',\n",
     "              fontsize=14, fontweight='bold')\n",
     "ax.grid()\n",
-    "plt.yscale('log')"
+    "ax.set_yscale('log')"
    ]
   },
   {
@@ -561,7 +564,7 @@
    "outputs": [],
    "source": [
     "def plot_par_distr(par):\n",
-    "    fig = plt.figure(figsize=(16,5))\n",
+    "    fig = plt.figure(figsize=(16, 5))\n",
     "    sel = fit_result['mask'] == 0\n",
     "    \n",
     "    for i in range(n_peaks_fit) :\n",
@@ -582,7 +585,7 @@
     "                    log=True,color='g',\n",
     "                    label='good fits only',\n",
     "                   )\n",
-    "        plt.xlabel(f\"g{i} {par} [ADU]\")\n",
+    "        ax.set_xlabel(f\"g{i} {par} [ADU]\")\n",
     "        ax.legend()\n",
     "        \n",
     "plot_par_distr('mean')\n",
@@ -603,7 +606,7 @@
     "        }\n",
     "fig = plt.figure(figsize=(16,5))\n",
     "for i, (par, data) in enumerate(dsets.items()):\n",
-    "    ax = fig.add_subplot(1,3,i+1)\n",
+    "    ax = fig.add_subplot(1, 3, i+1)\n",
     "    plt_range=get_range(data, 10)\n",
     "    num_bins = 100\n",
     "    _ = xana.histPlot(ax,data.flatten(), \n",
@@ -616,14 +619,14 @@
     "                log=True,color='g',\n",
     "                label='good fits only',\n",
     "               )\n",
-    "    plt.xlabel(f\"{par}\")\n",
+    "    ax.set_xlabel(f\"{par}\")\n",
     "    ax.legend()\n",
     "    if 'd01' in par :\n",
-    "        plt.axvline(d0_lim[0])\n",
-    "        plt.axvline(d0_lim[1])\n",
+    "        ax.axvline(d0_lim[0])\n",
+    "        ax.axvline(d0_lim[1])\n",
     "    if 'rel' in par :\n",
-    "        plt.axvline(gain_lim[0])\n",
-    "        plt.axvline(gain_lim[1])"
+    "        ax.axvline(gain_lim[0])\n",
+    "        ax.axvline(gain_lim[1])"
    ]
   },
   {
@@ -701,7 +704,8 @@
    "metadata": {},
    "outputs": [],
    "source": [
-    "fig = plt.figure(figsize=(10, 5))\n",
+    "fig, ax = plt.subplots()\n",
+    "fig.set_size_inches(10, 5)\n",
     "\n",
     "n_bars = 8\n",
     "x = np.arange(n_bars)\n",
@@ -753,12 +757,13 @@
     "         'No Entry',\n",
     "         'Gain deviation']\n",
     "\n",
-    "plt.bar(x, y2, width, label='Only this cut')\n",
-    "plt.bar(x, y, width, label='Cut flow')\n",
-    "plt.xticks(x, labels, rotation=90)\n",
-    "plt.ylim(y[5]-0.5, 100)\n",
-    "plt.grid(True)\n",
-    "plt.legend()\n",
+    "ax.bar(x, y2, width, label='Only this cut')\n",
+    "ax.bar(x, y, width, label='Cut flow')\n",
+    "ax.set_xticks(x)\n",
+    "ax.set_xticklabels(labels, rotation=90)\n",
+    "ax.set_ylim(y[5]-0.5, 100)\n",
+    "ax.grid(True)\n",
+    "ax.legend()\n",
     "plt.show()"
    ]
   }