Студопедия
Случайная страница | ТОМ-1 | ТОМ-2 | ТОМ-3
АвтомобилиАстрономияБиологияГеографияДом и садДругие языкиДругоеИнформатика
ИсторияКультураЛитератураЛогикаМатематикаМедицинаМеталлургияМеханика
ОбразованиеОхрана трудаПедагогикаПолитикаПравоПсихологияРелигияРиторика
СоциологияСпортСтроительствоТехнологияТуризмФизикаФилософияФинансы
ХимияЧерчениеЭкологияЭкономикаЭлектроника

Plotting Lines and Markers

Читайте также:
  1. Application deadlines
  2. Arrange the following headlines in the proper order
  3. Biomarkers in organic matter of Jurassic deposits in the western part of the Yenisei-Khatanga regional trough, Russia
  4. Contents of disciplines
  5. Edges of sides that recede toward the left are on lines converging at the left vanishing point.
  6. Exercise 3. Fill in the gaps with appropriate organisation and narrative markers.
  7. General Guidelines for the Diabetic Diet.

If you specify a marker type but not a linestyle, SCILAB draws only the marker. For example,

plot(x,y,'ks')

plots black squares at each data point, but does not connect the markers with a line.

The statement

plot(x,y,'r:+')

plots a red dotted line and places plus sign markers at each data point. You may want to use fewer data points to plot the markers than you use to plot the lines. This example plots the data twice using a different number of points for the dotted line and marker plots.

>>x1 = 0:pi/100:2*pi;

>>x2 = 0:pi/10:2*pi;

>>plot(x1,sin(x1),'r:',x2,sin(x2),'r+')

Figure 5.3 - This example plots the data twice using a different number of points for the dotted line and marker plots

Figure command

The figure command creates a new figure object using default property value:

>>x1=[-2*pi:0.01:-pi];

>>y1=pi*sin(x1);

>>x2=[-pi:0.01:pi];

>>y2=pi-abs(x2);

>>x3=[pi:0.01:2*pi];

>>y3=pi*sin(x3).^3;

>>figure;plot(x1,y1);grid on;

>>figure;plot(x2,y2);grid on;figure;plot(x3,y3);grid on

Adding Plots to an Existing Graph

The hold command enables you to add plots to an existing graph. When you type

>>hold on

SCILAB does not replace the existing graph when you issue another plotting command; it adds the new data to the current graph, rescaling the axes if necessary.

>>x1=[-2*pi:0.01:-pi];

>>y1=pi*sin(x1);

>>x2=[-pi:0.01:pi];

>>y2=pi-abs(x2);

>>x3=[pi:0.01:2*pi];

>>y3=pi*sin(x3).^3;

>>figure;plot(x1,y1);hold on;plot(x2,y2);hold on;plot(x3,y3);grid on

Create axes in tiled positions

Command subplot(m,n,p), or subplot(mnp), breaks the Figure window into an m-by-n matrix of small axes, selects the p-th axes for for the current plot, and returns the axis handle. The axes are counted along the top row of the Figure window, then the second row, etc. For example,

>> figure; subplot(3,1,1); plot(x1,y1); grid on

>> subplot(3,1,2); plot(x2,y2); grid on

>> subplot(3,1,3); plot(x3,y3);grid on

Figure 5.4 - Illustration shows 3 subplot regions and indicates the command used to create each

Controlling the Axes

The axis command supports a number of options for setting the scaling, orientation, and aspect ratio of plots. You can also set these options interactively.

Setting Axis Limits

By default, SCILAB finds the maxima and minima of the data to choose the axis limits to span this range. The axis command enables you to specify your own limits

axis([xmin xmax ymin ymax])

or for three-dimensional graphs,

axis([xmin xmax ymin ymax zmin zmax])


Дата добавления: 2015-10-29; просмотров: 147 | Нарушение авторских прав


Читайте в этой же книге: The Basic Opportunities of Spreadsheets | Calculations in Calc. Creating and Coping Formulas | Operators. Expressions use familiar arithmetic operators and precedence rules. | Intrinsic SCILAB Functions | Examples of Expressions | Individual Tasks |
<== предыдущая страница | следующая страница ==>
Multiple Data Sets in One Graph| Printing from the Menu

mybiblioteka.su - 2015-2024 год. (0.01 сек.)