Please enable JavaScript to view this site.

Knowledge Base

Navigation: Scripting Language > Plotting commands

plot

We've made some changes. Use 'Ctrl-F5' to clear your browser cache.
Scroll Prev Top Next More

Creates line plots. All data sets must be sampled on the same position vector.

 

See plotxy for data sets that are sampled on different position vectors.

 

Supported Product: FDTD, MODE, DEVICE, INTERCONNECT

 

Syntax

Description

out = plot(x,y);

Creates a plot of y vs x, y and x are both 1D vectors with the same length.

The figure number is returned.

plot(x,y);

x is a nx1 matrix.

y is a nxm matrix.

This will generate a graph with m lines. (y(1:n,1) vs x, y(1:n,2) vs x, etc)

plot(x,y1,y2,y3);

Creates a plot with 3 curves, x,y1, y2, y3 must be the same length, returns the figure number.

plot(x,y, "x label", "y label", "title");

Creates a plot of y vs x with axis labels and a title, returns the figure number.

plot(x,y, "x label", "y label", "title", "options");

Creates a plot with desired options. Options are listed in the table below.

Returns the figure number.

 

Parameter

 

Description

Acceptable values

Output

options

optional

plot setting options

 

Examples

This example will generate a figure with two lines: sin(x) and (sin(x))^2.

x=linspace(0,10,100);

y1=sin(x);

y2=y1^2;

plot(x,y1,y2,"x","y","title");

legend("sin(x)", "sin(x)^2");

 

The following figure shows the output of the the example code.

 

ref_fdtd_scripts_plot_ex1_zoom67

 

This example will generate a figure with two lines: sin(x) and sin(x)^2 with more plotting options.

x=linspace(0,10,100);

y1=sin(x);

y2=y1^2;

plot(x,y1,"x","y","title", "plot type=line, color=red, pen=-., linewidth=2");

holdon;

plot(x,y2,"x","y","title", "plot type=line, color=blue, pen=--, linewidth=2");

legend("sin(x)", "sin(x)^2");

 

The following figure shows the output of the the example code.

 

scripts_plot_ex2_zoom65

 

See Also

Plotting commands, plotxy, holdon legend, image, closeall, setplot, exportfigure, visualize, vectorplot, polar

Copyright Lumerical Inc. | Privacy | Site Map