Function:s2sch

From S2PLOT

Jump to: navigation, search

s2sch

Set the character height in "arbitrary" units.

Prototype

void s2sch(float size);

Description

Set the character height in "arbitrary" units. The default character size is 1.0, corresponding to a character about 15 pixels in size. Changing the character height also changes the scale of tick marks and symbols.

See Also

s2qch Query the character height.
s2slw Set the linewidth in pixels.

PGPLOT Equivalent

PGSCH

Code Example

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

int main(int argc, char *argv[])
{
   float x = 0.0;                               /* Text location */
   float y = 0.0;
   float z = 0.0;
   int N = 4;                                   /* Number of strings */
   int i;                                       /* Loop variable */
   float height;                                /* Height of text */
   char string[32];                             /* String of text */

   srand48((long)time(NULL));                   /* Seed random numbers */
   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 */

   for (i=0;i<N;i++) {
      s2sci((i%15)+1);                          /* Set the colour */
      height = (i+1)*0.3;
      sprintf(string,"Height = %.1f\n",height); /* Create the string */
      x = drand48()*1.6 - 0.8;                  /* Random text location */
      y = drand48()*1.6 - 0.8;
      z = drand48()*1.6 - 0.8;
      s2sch(height);                    /* Set text height */
      s2textxy(x,y,z,string);                   /* Write some text in x-y plane */
   }

   s2show(1);                                   /* Open the s2plot window */

   return 1;
}

Back to S2PLOT function list.


Personal tools