Function:s2icm

From S2PLOT

(Difference between revisions)
Jump to: navigation, search
Revision as of 03:03, 28 October 2007
S2plot admin (Talk | contribs)

← Previous diff
Revision as of 03:04, 28 October 2007
S2plot admin (Talk | contribs)

Next diff →
Line 15: Line 15:
<table width=50%> <table width=50%>
<tr><td>[[image:rainbow_cm.jpg]]</td><td width=40%>rainbow</td> <tr><td>[[image:rainbow_cm.jpg]]</td><td width=40%>rainbow</td>
-<td><img src="colmaps/0002.jpg"></td><td width=40%>grey, gray</td></tr>+<td>[[image:grey_cm.jpg]]</td><td width=40%>grey, gray</td></tr>
-<tr><td><img src="colmaps/0004.jpg"></td><td>terrain, topo</td>+<tr><td>[[image:terrain_cm.jpg]]</td><td>terrain, topo</td>
-<td><img src="colmaps/0006.jpg"></td><td>iron, heated, hot</td></tr>+<td>[[image:iron_cm.jpg]]</td><td>iron, heated, hot</td></tr>
-<tr><td><img src="colmaps/0008.jpg"></td><td>astro</td>+<tr><td>[[image:astro_cm.jpg]]</td><td>astro</td>
-<td><img src="colmaps/0010.jpg"></td><td>alt, zebra</td>+<td>[[image:alt_cm.jpg]]</td><td>alt, zebra</td>
-<tr><td><img src="colmaps/0012.jpg"></td><td>mgreen</td></tr>+<tr><td>[[image:mgreen_cm.jpg]]</td><td>mgreen</td></tr>
</table> </table>

Revision as of 03:04, 28 October 2007

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:

</table>


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

See Also

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
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