浏览代码

Improved the drawing of flow lines.

Ovidio Peña Rodríguez 4 年之前
父节点
当前提交
7abe04ee43
共有 2 个文件被更改,包括 9 次插入6 次删除
  1. 4 3
      examples/field-Ag-flow.py
  2. 5 3
      examples/fieldplot.py

+ 4 - 3
examples/field-Ag-flow.py

@@ -76,7 +76,7 @@ comment = 'bulk-WL' + str(WL) + 'nm_r' + str(core_r) + 'nm_epsilon' + str(epsilo
 WL_units = 'nm'
 npts = 251
 factor = 2.1
-flow_total = 9
+flow_total = 41
 # flow_total = 21
 # flow_total = 0
 crossplane = 'XZ'
@@ -92,8 +92,9 @@ import matplotlib.pyplot as plt
 
 fig, axs = plt.subplots(1, 1)  # , sharey=True, sharex=True)
 fig.tight_layout()
-fieldplot(fig, axs, x, m, WL, comment, WL_units, crossplane, field_to_plot, npts, factor, flow_total,
-          subplot_label=' ', is_flow_extend=False)
+fieldplot(fig, axs, x, m, WL, comment, WL_units, crossplane, field_to_plot, npts, factor,
+          flow_total, density=50.0, maxlength=40.0, arrowstyle='-',
+          subplot_label=' ', draw_shell=True)
 
 # fieldplot(x,m, WL, comment, WL_units, crossplane, field_to_plot, npts, factor, flow_total, is_flow_extend=False)
 

+ 5 - 3
examples/fieldplot.py

@@ -116,7 +116,9 @@ def GetField(crossplane, npts, factor, x, m, pl):
 
 
 def fieldplot(fig, ax, x, m, WL, comment='', WL_units=' ', crossplane='XZ',
-              field_to_plot='Pabs', npts=101, factor=2.1, flow_total=11,
+              field_to_plot='Pabs', npts=101, factor=2.1,
+              flow_total=11, density=20, minlength=0.1, maxlength=4.0,
+              arrowstyle='-|>', arrowsize=1.0,
               pl=-1, draw_shell=False, outline_width=1, subplot_label=' '):
 
     E, H, S, scan, Sx, Sy = GetField(crossplane, npts, factor, x, m, pl)
@@ -213,9 +215,9 @@ def fieldplot(fig, ax, x, m, WL, comment='', WL_units=' ', crossplane='XZ',
             # Plot the streamlines with an appropriate colormap and arrow style
             ax.streamplot(scale, scale, Sx, Sy,
                           start_points=points, integration_direction='both',
-                          density=20.0,
+                          density=density, minlength=minlength, maxlength=maxlength,
                           linewidth=outline_width, color='white',
-                          arrowstyle='-|>', arrowsize=1.0)
+                          arrowstyle=arrowstyle, arrowsize=arrowsize)
     finally:
         terms, Qext, Qsca, Qabs, Qbk, Qpr, g, Albedo, S1, S2 = scattnlay(x, m)
         print("Qsca = " + str(Qsca))