Please enable JavaScript to view this site.

Knowledge Base

Navigation: Scripting Language > Plotting commands

bar

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

Plots a bar chart.

 

Supported Product: FDTD, MODE, DEVICE, INTERCONNECT

 

Syntax

Description

out = bar(y);

Creates a bar plot where each bar corresponds to one element in y, which must be a 1D array. The figure number is returned.

bar(x,y);

x is a nx1 matrix.

y is a nxm matrix.

Creates m bar plots with n bars in the same figure for the elements in y at positions given by x. The figure number is returned.

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

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

 

Examples

The following example generates the two bar plots shown below.

x = linspace(0,1,10);

y1 = exp(-((x-0.2)/0.4)^2);

y2 = exp(-((x-0.7)/0.3)^2);

y = [y1,y2];

 

bar(y1); # bar plot for y1, where each bar is labeled from 1 to 10

bar(x,y); # bar plot for y1 and y2 at locations specified by x

 

bar_script_example1_zoom63

bar_script_example2_zoom63

 

See Also

Plotting commands, histc, plot

Copyright Lumerical Inc. | Privacy | Site Map