Function:s2sci

From S2PLOT

Revision as of 02:24, 23 November 2007; view current revision
←Older revision | Newer revision→
Jump to: navigation, search

s2sci

Set the pen colour by index.

Prototype

void s2sci(int idx);

Description

Set the pen colour by index. If it lies outside the defined range, it will be set to the default colour (white).

See Also

s2qciQuery the colour index.
s2scir Set the range of colour indices used for shading.

PGPLOT Equivalent

PGSCI

Code Example

#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include "s2plot.h"

int main(int argc, char *argv[])
{
   int i;					/* Loop variable */
   int N = 50;					/* Number of points */
   float x[50], y[50], z[50];			/* Coordinates of points */
   int symbol = 1;				/* Point symbol */

   srand48((long)time(NULL));			/* Seed random numbers */
   for (i=0;i<N;i++) {
      x[i] = drand48()*2.0 - 1.0;
      y[i] = drand48()*2.0 - 1.0;
      z[i] = drand48()*2.0 - 1.0;
   }

   s2opend("/?",argc, argv);			/* Open the display */
   s2swin(-1.,1., -1.,1., -1.,1.);		/* Set the window coordinates */
   s2box("BCDET",0,0,"BCDET",0,0,"BCDET",0,0);	/* Draw coordinate box */

   s2sch(2);					/* Sets size of most symbols */
   s2slw(2);					/* Sets size of point */
   for (i=0;i<N;i++) {
      s2sci((i%15) + 1);			/* Set the colour */
      s2pt1(x[i],y[i],z[i],symbol);		/* Draw a single point */
   }
   s2show(1);					/* Open the s2plot window */
   
   return 1;
}

Back to S2PLOT function list.


Personal tools