Contour plots



There is currently no built-in method to generate a contour plot, but the following script file collects the E intensity profile from the FDE solver and adds a contour line at a specified E intensity value.
plot_E2_with_contour.lsf (1.4 KB)

It works by looping through each position in the field intensity profile and using the almostequal script command to compare the intensity with the threshold intensity. If the value of the field intensity is within the relative difference range around the threshold value, it then sets the value of the data at that position to the maximum value of the E intensity which will show up in red in an image plot. Below is the original field profile and a field profile with contour plotted by using the script file with the example file from the Arrow waveguide example:

This method of adding a line to a field profile plot is also used to add a structure outlines:

When using this script, the mesh step size and the relative difference value on line 21 of the script may need to be tweaked since the thickness of the contour line is limited by the mesh step size, and the if the gradient of the field intensity is large so that the values of the field intensity change rapidly from one mesh cell to the next there may not be any cells within the specified range of field intensities, so in this case the relative difference value would need to be increased.

If the threshold is set to be close to the maximum field intensity value, the contrast in colour between the contour line and the field data would be poor – so in this case the value to set the data to might be changed to 0 instead of the maximum field intensity (on line 31) which would give a blue line for the contour instead.

Another method to generate a contour plot is to export the data to Matlab using the matlabsave script command and use the built-in contour script functions in Matlab to generate the desired plot:

등고선 그래프를 그리는 방법
Contour plot of reflectance for varying radius and spacing of nanohole arrays