Function:s2icm

From S2PLOT

Revision as of 03:05, 28 October 2007; view current revision
←Older revision | Newer revision→
Jump to: navigation, search

s2icm

Install various colour maps.

Prototype

int s2icm(char *mapname, int idx1, int idx2);

Description

Install various colour maps. Give map name as a string, and index range where you want the map installed. Available maps are:

image:rainbow_cm.jpgrainbow image:grey_cm.jpggrey, gray
image:terrain_cm.jpgterrain, topo image:iron_cm.jpgiron, heated, hot
image:astro_cm.jpgastro image:alt_cm.jpgalt, zebra
image:mgreen_cm.jpgmgreen


and may be preceeded by the exact string "inverse " (note the space is significant) to reverse the map direction.

See Also

struct_COLOUR Data structure for (r,g,b) colour indices.
ss2lcm Load a colourmap into memory.

PGPLOT Equivalent

PGSITF

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 */
   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 */
   
   col1 = col2;				
   col2 = col2 + N;
   s2scir(col1, col2);				/* Set the colour index range */
   s2icm("mgreen", col1, col2);			/* Install a colour map */

   for (i=0;i<N;i++) {
      s2sci(col1+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.


Personal tools