--- original
+++ modified
@@ -11,6 +11,7 @@
 #   using conservation laws.
 # - Use of discrete symmetries to relate scattering states.
 
+import _defs
 import kwant
 
 import tinyarray
@@ -18,6 +19,7 @@
 
 # For plotting
 from matplotlib import pyplot
+from contextlib import redirect_stdout
 
 tau_x = tinyarray.array([[0, 1], [1, 0]])
 tau_y = tinyarray.array([[0, -1j], [1j, 0]])
@@ -74,11 +76,19 @@
         data.append(smatrix.submatrix((0, 0), (0, 0)).shape[0] -
                     smatrix.transmission((0, 0), (0, 0)) +
                     smatrix.transmission((0, 1), (0, 0)))
-    pyplot.figure()
+    fig = pyplot.figure()
     pyplot.plot(energies, data)
     pyplot.xlabel("energy [t]")
     pyplot.ylabel("conductance [e^2/h]")
-    pyplot.show()
+    pyplot.setp(fig.get_axes()[0].get_xticklabels(),
+                fontsize=_defs.mpl_tick_size)
+    pyplot.setp(fig.get_axes()[0].get_yticklabels(),
+                fontsize=_defs.mpl_tick_size)
+    fig.set_size_inches(_defs.mpl_width_in, _defs.mpl_width_in * 3. / 4.)
+    fig.subplots_adjust(left=0.15, right=0.95, top=0.95, bottom=0.15)
+    for extension in ('pdf', 'png'):
+        fig.savefig("superconductor_transport_result." + extension,
+                    dpi=_defs.dpi)
 
 def check_PHS(syst):
     # Scattering matrix
@@ -103,14 +113,13 @@
 def main():
     syst = make_system(W=10)
 
-    # Check that the system looks as intended.
-    kwant.plot(syst)
-
     # Finalize the system.
     syst = syst.finalized()
 
     # Check particle-hole symmetry of the scattering matrix
-    check_PHS(syst)
+    with open('check_PHS_out.txt', 'w') as f:
+        with redirect_stdout(f):
+            check_PHS(syst)
 
     # Compute and plot the conductance
     plot_conductance(syst, energies=[0.002 * i for i in range(-10, 100)])
