@@ -1,121 +1,130 @@
 # Tutorial 2.2.2. Transport through a quantum wire
 # ================================================
 #
 # Physics background
 # ------------------
 #  Conductance of a quantum wire; subbands
 #
 # Kwant features highlighted
 # --------------------------
 #  - Builder for setting up transport systems easily
 #  - Making scattering region and leads
 #  - Using the simple sparse solver for computing Landauer conductance
 
+import _defs
 from matplotlib import pyplot
 #HIDDEN_BEGIN_dwhx
 import kwant
 #HIDDEN_END_dwhx
 
 # First, define the tight-binding system
 
 #HIDDEN_BEGIN_goiq
 syst = kwant.Builder()
 #HIDDEN_END_goiq
 
 # Here, we are only working with square lattices
 #HIDDEN_BEGIN_suwo
 a = 1
 lat = kwant.lattice.square(a)
 #HIDDEN_END_suwo
 
 #HIDDEN_BEGIN_zfvr
 t = 1.0
 W = 10
 L = 30
 
 # Define the scattering region
 
 for i in range(L):
     for j in range(W):
         # On-site Hamiltonian
         syst[lat(i, j)] = 4 * t
 
         # Hopping in y-direction
         if j > 0:
             syst[lat(i, j), lat(i, j - 1)] = -t
 
         # Hopping in x-direction
         if i > 0:
             syst[lat(i, j), lat(i - 1, j)] = -t
 #HIDDEN_END_zfvr
 
 # Then, define and attach the leads:
 
 # First the lead to the left
 # (Note: TranslationalSymmetry takes a real-space vector)
 #HIDDEN_BEGIN_xcmc
 sym_left_lead = kwant.TranslationalSymmetry((-a, 0))
 left_lead = kwant.Builder(sym_left_lead)
 #HIDDEN_END_xcmc
 
 #HIDDEN_BEGIN_ndez
 for j in range(W):
     left_lead[lat(0, j)] = 4 * t
     if j > 0:
         left_lead[lat(0, j), lat(0, j - 1)] = -t
     left_lead[lat(1, j), lat(0, j)] = -t
 #HIDDEN_END_ndez
 
 #HIDDEN_BEGIN_fskr
 syst.attach_lead(left_lead)
 #HIDDEN_END_fskr
 
 # Then the lead to the right
 #HIDDEN_BEGIN_xhqc
 sym_right_lead = kwant.TranslationalSymmetry((a, 0))
 right_lead = kwant.Builder(sym_right_lead)
 
 for j in range(W):
     right_lead[lat(0, j)] = 4 * t
     if j > 0:
         right_lead[lat(0, j), lat(0, j - 1)] = -t
     right_lead[lat(1, j), lat(0, j)] = -t
 
 syst.attach_lead(right_lead)
 #HIDDEN_END_xhqc
 
 # Plot it, to make sure it's OK
 #HIDDEN_BEGIN_wsgh
-kwant.plot(syst)
+size = (_defs.figwidth_in, 0.3 * _defs.figwidth_in)
+for extension in ('pdf', 'png'):
+    kwant.plot(syst, file="quantum_wire_syst." + extension,
+               fig_size=size, dpi=_defs.dpi)
 #HIDDEN_END_wsgh
 
 # Finalize the system
 #HIDDEN_BEGIN_dngj
 syst = syst.finalized()
 #HIDDEN_END_dngj
 
 # Now that we have the system, we can compute conductance
 #HIDDEN_BEGIN_buzn
 energies = []
 data = []
 for ie in range(100):
     energy = ie * 0.01
 
     # compute the scattering matrix at a given energy
     smatrix = kwant.smatrix(syst, energy)
 
     # compute the transmission probability from lead 0 to
     # lead 1
     energies.append(energy)
     data.append(smatrix.transmission(1, 0))
 #HIDDEN_END_buzn
 
 # Use matplotlib to write output
 # We should see conductance steps
 #HIDDEN_BEGIN_lliv
-pyplot.figure()
+fig = pyplot.figure()
 pyplot.plot(energies, data)
-pyplot.xlabel("energy [t]")
-pyplot.ylabel("conductance [e^2/h]")
-pyplot.show()
+pyplot.xlabel("energy [t]", fontsize=_defs.mpl_label_size)
+pyplot.ylabel("conductance [e^2/h]", fontsize=_defs.mpl_label_size)
+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("quantum_wire_result." + extension, dpi=_defs.dpi)
 #HIDDEN_END_lliv