Browse code

add a whatsnew entry

Joseph Weston authored on 18/12/2019 16:23:57
Showing 1 changed files
... ...
@@ -65,6 +65,33 @@ rather than::
65 65
     kwant.lattice.square()
66 66
 
67 67
 
68
+Plotly for plots
69
+----------------
70
+Kwant can now use the `Plotly <https://plot.ly/>`_ library when plotting,
71
+though matplotlib is still used by default. Using plotly empowers Kwant
72
+to produce high-quality interactive plots, as well as true 3D support:
73
+
74
+.. jupyter-execute::
75
+    :hide-code:
76
+
77
+    import kwant
78
+    import kwant.plotter
79
+
80
+.. jupyter-execute::
81
+
82
+    lat = kwant.lattice.cubic(norbs=1)
83
+    syst = kwant.Builder()
84
+
85
+    def disk(r):
86
+        x, y, z = r
87
+        return -2 <= z < 2 and 10**2 < x**2 + y**2 < 20**2
88
+
89
+    syst[lat.shape(disk, (15, 0, 0))] = 4
90
+
91
+    kwant.plotter.set_engine("plotly")
92
+    kwant.plot(syst);
93
+
94
+
68 95
 Automatic addition of Peierls phase terms to Builders
69 96
 -----------------------------------------------------
70 97
 Kwant 1.4 introduced `kwant.physics.magnetic_gauge` for computing Peierls