Function:s2wedge

From S2PLOT

(Difference between revisions)
Jump to: navigation, search
Revision as of 05:36, 13 December 2007
S2plot admin (Talk | contribs)

← Previous diff
Revision as of 05:36, 13 December 2007
S2plot admin (Talk | contribs)

Next diff →
Line 3: Line 3:
Draw a colour wedge. Draw a colour wedge.
-<bold>This is a deprecated function. Use ss2tsc to draw colour wedges and other on-screen annotations.</bold>+<b>This is a deprecated function. Use ss2tsc to draw colour wedges and other on-screen annotations.</b>
==Prototype== ==Prototype==
Line 18: Line 18:
== See Also == == See Also ==
<table> <table>
 +<tr><td>[[Function:s2tsc | s2tsc ]]</td><td>Enable/disable drawing in screen coordinates. </td></tr>
<tr><td>[[Function:s2scir | s2scir ]]</td><td>Set the range of colour indices used for shading. </td></tr> <tr><td>[[Function:s2scir | s2scir ]]</td><td>Set the range of colour indices used for shading. </td></tr>
</table> </table>

Revision as of 05:36, 13 December 2007

s2wedge

Draw a colour wedge.

This is a deprecated function. Use ss2tsc to draw colour wedges and other on-screen annotations.

Prototype

void s2wedge(char *title, float fx1, float fx2, float fy1, float fy2, float dmin, float dmax, 
int annocolidx);

Description

Draw a colour wedge, using the most recently used section of the colour map (as set with s2scir), and associate the smallest colour index with the data value dmin, and the largest colour index with the data value dmax. The wedge will be drawn to cover the fractional surface of the entire window (fx1, fy1) -> (fx2, fy2). Labelling of the wedge is done in the colour given by annocolidx. It is advisable to keep title short, eg. just use it to include the units on the wedge.

See Also

s2tsc Enable/disable drawing in screen coordinates.
s2scir Set the range of colour indices used for shading.

PGPLOT Equivalent

PGWEDG

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 */
   }

   s2wedge("Range", 0.1, 0.15, 0.1, 0.4, -1.0, 1.0, S2_PG_YELLOW);
						/* Draw the data wedge */
   s2show(1);                                   /* Open the s2plot window */

   return 1;
}

Back to S2PLOT function list.


Personal tools