Skip to content
Snippets Groups Projects
Forked from kwant / kwant
1265 commits behind the upstream repository.
plot_graphene.py.diff 2.75 KiB
--- original
+++ modified
@@ -9,6 +9,7 @@
 # --------------------------
 #  - demonstrate different ways of plotting
 
+import _defs
 import kwant
 from matplotlib import pyplot
 
@@ -32,9 +33,11 @@
 
 
 def plot_system(sys):
-    kwant.plot(sys)
-    # the standard plot is ok, but not very intelligible. One can do
-    # better by playing wioth colors and linewidths
+    # standard plot - not very intelligible for this particular situation
+    size = (_defs.figwidth_in, _defs.figwidth_in)
+    for extension in ('pdf', 'png'):
+        kwant.plot(sys, file="plot_graphene_sys1." + extension,
+                   fig_size=size, dpi=_defs.dpi)
 
     # use color and linewidths to get a better plot
     def family_color(site):
@@ -43,7 +46,11 @@
     def hopping_lw(site1, site2):
         return 0.04 if site1.family == site2.family else 0.1
 
-    kwant.plot(sys, site_lw=0.1, site_color=family_color, hop_lw=hopping_lw)
+    size = (_defs.figwidth_in, _defs.figwidth_in)
+    for extension in ('pdf', 'png'):
+        kwant.plot(sys, site_lw=0.1, site_color=family_color,
+                   hop_lw=hopping_lw, file="plot_graphene_sys2." + extension,
+                   fig_size=size, dpi=_defs.dpi)
 
 
 def plot_data(sys, n):
@@ -58,7 +65,11 @@
     # the usual - works great in general, looks just a bit crufty for
     # small systems
 
-    kwant.plotter.map(sys, wf, oversampling=10)
+    size = (_defs.figwidth_in, _defs.figwidth_in)
+    for extension in ('pdf', 'png'):
+        kwant.plotter.map(sys, wf, oversampling=10,
+                          file="plot_graphene_data1." + extension,
+                          fig_size=size, dpi=_defs.dpi)
 
     # use two different sort of triangles to cleanly fill the space
     def family_shape(i):
@@ -68,15 +79,22 @@
     def family_color(i):
         return 'black' if sys.site(i).family == a else 'white'
 
-    kwant.plot(sys, site_color=wf, site_symbol=family_shape,
-               site_size=0.5, hop_lw=0, cmap='jet')
+    size = (_defs.figwidth_in, _defs.figwidth_in)
+    for extension in ('pdf', 'png'):
+        kwant.plot(sys, site_color=wf, site_symbol=family_shape,
+                   site_size=0.5, hop_lw=0, cmap='jet',
+                   file="plot_graphene_data2." + extension,
+                   fig_size=size, dpi=_defs.dpi)
 
     # plot by changing the symbols itself
     def site_size(i):
         return 3 * wf[i] / wf.max()
 
-    kwant.plot(sys, site_size=site_size, site_color=(0,0,1,0.3),
-               hop_lw=0.1)
+    size = (_defs.figwidth_in, _defs.figwidth_in)
+    for extension in ('pdf', 'png'):
+        kwant.plot(sys, site_size=site_size, site_color=(0,0,1,0.3),
+                   hop_lw=0.1, file="plot_graphene_data3." + extension,
+                   fig_size=size, dpi=_defs.dpi)
 
 
 def main():