

A third vector specifies the z coordinates of the intersection points of the grid. The grid is obtained by computing the coordinates of all intersection points. The grid is generated by specifying two vectors giving the coordinates along the x- and y-axes. The grid spacing along x- and y-axes may or may not be the same.īy specifying the coordinates of the four corners of four sided polygons (or facets). That is, (x, y, z) coordinates of intersction points of a grid in the x-y plane. There are two ways in which 3D graphs can be plotted in Scilab:īy specifying z coordinates of intersection of a grid lying in the x-y plane. To plot 3D graphs, we need (x, y, z) coordinates of points lying on the surface. While 2D graphs are lines, 3D graphs are surfaces. It displays a tree diagram showing all the components of the graph, and you can interactively modify fonts, font sizes, axis labels, grids etc. To interactively modify the different properties of the graph, click on Edit -> Figure Properties. When the plot() function finishes plotting the graph, you see a graphic window, with its own main menu and the graph shown underneath. Use the online help to learn more about the legend() function. >plot(x, y) xgrid(1) xtitle('Harmonic Functions', 'x', 'sin(x), cos(x)') legend(, 3)įirst argument to legend() is an array of strings containing the legend text and the second argument specifies the position. In the same way, we could define a legend with the legend() function as follows: Using the xtitle() function, we defined the title of the graph (first argument), title for the x-axis (second argument) and title for the y-axis (third argument). Using xgrid() function, we told Scilab to plot grids parallel to the x- and y-axes in black color (argument 1 to the function xgrid()). Since y contains two columns, Scilab understands that it must plot two lines in the graph, one each for each column of values.

The number of rows in x and y must be the same. Using the plot() function, we told Scilab to look for values of x in the first variable (namely x) and look for values of y in the second variable (namely y). This must result in the following graph being plotted: >plot(x, y) xgrid(1) xtitle('Harmonic Functions', 'x', 'sin(x) and cos(x)') Then we will create the matrix y, containing the same number of rows as x, with values of sin(x) in its first column and values of cos(x) in its second column. We will first create vector x, containing the values of the independent variable x. Let us plot a graph of sin(x) and cos(x) over the range x = 0 to 2 pi. Function plotting programs will decide the range of the values of independent variable and its data interval, generate the data on the fly and plot the graph. This is in contrast to function plotting programs (such as gnuplot) which plot graphs of functions without the user having to first explicitly generate the data required to plot the graph. Scilab is a data plotter, that is, it plots graphs from the data you input. In this session, we will learn the following functions: Plotting multiple graphs on one page (subplot())

In this session you will learn the following:Īnnotating graphs with grids, axis labels, graph titlesĮxporting graphs for inclusion in documents
