Function:s2sci
From S2PLOT
(Difference between revisions)
Revision as of 08:36, 27 October 2007 S2plot admin (Talk | contribs) ← Previous diff |
Current revision S2plot admin (Talk | contribs) |
||
Line 15: | Line 15: | ||
== See Also == | == See Also == | ||
<table> | <table> | ||
+ | <tr><td>[[Function:s2qci | s2qci]]</td><td>Query the colour index. </td></tr> | ||
<tr><td>[[Function:s2scir | s2scir ]]</td><td>Set the range of colour indices used for shading. </td></tr> | <tr><td>[[Function:s2scir | s2scir ]]</td><td>Set the range of colour indices used for shading. </td></tr> | ||
</table> | </table> |
Current revision
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
s2qci | Query the colour index. |
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 = 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.