HowToC:DrawPoints

From S2PLOT

Revision as of 22:42, 10 December 2007; view current revision
←Older revision | Newer revision→
Jump to: navigation, search

Contents

Drawing Points

Points example

Copy and paste the following code, and save the file as s2points.c

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

int main(int argc, char *argv[])
{
   float xmin = -1, xmax = +1;          /* X data range */
   float ymin = -1, ymax = +1;          /* Y data range */
   float zmin = -1, zmax = +1;          /* Z data range */

   s2opend("/?",argc,argv);             /* Which S2PLOT device to open? */
   s2swin(xmin, xmax, ymin, ymax, zmin, zmax);  /* Set the display coordinates */

   s2show(1);                           /* Hand over to the display */

   return 1;
}

Compile using: cbuild.csh s2example<tt> and then run by typing <tt>s2example at the command prompt.

Experiment for yourself

Function Overview

For more information on the functions we have introduced so far, see:

[[Function:s2pt1|s2pt1] Draw a single point with a given symbol. s2pt Draw a set of points with a given symbol. s2pnts Draw a set of points with different markers. ns2m Draw a marker ns2vm Draw a marker - vector input ns2vpoint Draw a point at the given position and colour - vector input. ns2vnpoint Draw multiple points at the given positions with one colour - vector input. ns2thpoint Draw a thick point at given position, in colour and thickness in pixels (not world coords). ns2vthpoint Draw a thick point at given position, in colour and thickness in pixels (not world coords) - vector input. Colours Useful colour definitions based on PGPlot default settings. struct COLOUR Data structure for (r,g,b) colour indices.

Common Problems

Test code: s2points.c

This is the full test code for the point-drawing example.

Where to Next?

Personal tools