Browse code

Adds a tutorial to use the plotly engine.

Kelvin Loh authored on 11/12/2019 15:29:23
Showing 1 changed files
... ...
@@ -292,6 +292,29 @@ arbitrarily, allowing for a good inspection of the geometry from all sides.
292 292
     does not properly honor the corresponding arguments. By resizing the plot
293 293
     window however one can manually adjust the aspect ratio.
294 294
 
295
+If you also have plotly installed, you can now use the plotly engine for all
296
+the plotting functions within Kwant (except streamplots). The way you would do
297
+it is simple, just set the plotter engine to ``plotly`` and then call the
298
+plotting function as you would do with some minor changes (See note below). For
299
+example, from the previous plot, you would need to just do this:
300
+
301
+.. jupyter-execute::
302
+
303
+    kwant.plotter.set_engine('plotly') # Set to plotly engine
304
+
305
+    kwant.plot(syst)
306
+
307
+    kwant.plotter.get_engine() # Get the current engine
308
+
309
+    kwant.plotter.set_engine('matplotlib') # Set to matplotlib engine
310
+
311
+.. note::
312
+
313
+    By default, the engine would be set to matplotlib if both matplotlib and
314
+    plotly are installed, and if either are installed, then, the default would
315
+    be the one available in your system. Certain attributes such as dpi or
316
+    fig_size or ax are not supported.
317
+
295 318
 Also for 3D it is possible to customize the plot. For example, we
296 319
 can explicitly plot the hoppings as lines, and color sites differently
297 320
 depending on the sublattice: