Function:s2pnts
From S2PLOT
(Difference between revisions)
Current revision
s2pnts
Draw a set of points with different markers.
Prototype
void s2pnts(int np, float *xpts, float *ypts, float *zpts,int *symbols, int ns);
Description
Draw a set of points with different markers. The markers are selected from the array symbols of length ns. If ns == n, then the ith point is drawn with the ith symbol. If ns < n, then for the first ns points, the ith symbol is used for the ith point, thereafter the first symbol is used for all remaining points.
Available values for symbols are:
0 = wireframe box
1 = point
2 = wireframe 3D cross
4 = shaded sphere
6 = shaded box
See Also
s2pt1 | Draw a single point with a given symbol. |
s2pt | Draw a set of points with a given symbol. |
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[50]; /* Array of symbols */
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;
symbol[i] = (int)(drand48()*6); /* Random symbol 0...6 */
if (symbol[i] == 3) symbol[i] = 0; /* There is no symbol 3 */
if (symbol[i] == 5) symbol[i] = 6; /* There is no symbol 5 */
}
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 */
s2pnts(N,x,y,z,symbol,N); /* Draw the points */
s2show(1); /* Open the s2plot window */
return 1;
}
Back to S2PLOT function list.