Function:s2pt1
From S2PLOT
Revision as of 07:26, 27 October 2007; view current revision
←Older revision | Newer revision→
←Older revision | Newer revision→
s2pt1
Draw a single point with a given symbol.
Prototype
void s2pt1(float x, float y, float z, int symbol);
Description
Draw a single point at location (x,y,z) using symbol: 0 = wireframe box 1 = point 2 = wireframe 3D cross 4 = shaded sphere 6 = shaded box
See Also
s2pt | Draw a set of points with a given symbol. |
s2pnts | Draw a set of points with different markers. |
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 */
for (i=0;i<N;i++) {
s2sci(symbol[i] + 1); /* Set the colour */
s2pt1(x[i],y[i],z[i],symbol[i]); /* Draw a single point */
}
s2show(1); /* Open the s2plot window */
return 1;
}
Back to S2PLOT function list.