Function:s2qcir
From S2PLOT
(Difference between revisions)
Current revision
s2qcir
Query the colour index range.
Prototype
void s2qcir(int *col1, int *col2);
Description
Query the colour index range.
See Also
s2scir | Set the range of colour indices used for shading. |
PGPLOT Equivalent
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 = 100; /* Number of points */
float x[100], y[100], z[100]; /* Coordinates of points */
float r, g, b; /* RGB colours */
int symbol = 1; /* Point symbol */
int col1, col2; /* Colour index range */
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 */
s2slw(5); /* Sets size of point */
s2qcir(&col1, &col2); /* Query the colour range */
s2scir(col2, col2+N); /* Set the colour index range */
for (i=col2;i<N;i++) { /* New colours */
r = drand48(); /* Choose random red value */
g = r; /* Green = Blue = Red */
b = r; /* means grey-scale! */
s2scr(i, r, g, b); /* Set colour representation */
}
for (i=0;i<N;i++) {
s2sci(i); /* 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.