Function:s2sch

From S2PLOT

(Difference between revisions)
Jump to: navigation, search
Revision as of 05:43, 26 October 2007
136.186.1.190 (Talk)

← Previous diff
Current revision
S2plot admin (Talk | contribs)

Line 1: Line 1:
-hello from me+==s2sch==
 + 
 +Set the character height in "arbitrary" units.
 + 
 +==Prototype==
 + 
 +<code><pre>
 +void s2sch(float size);
 +</pre></code>
 + 
 +==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 ==
 +<table>
 +<tr><td>[[Function:s2qch | s2qch ]]</td><td>Query the character height. </td></tr>
 +<tr><td>[[Function:s2slw | s2slw ]]</td><td>Set the linewidth in pixels. </td></tr>
 +</table>
 + 
 +==PGPLOT Equivalent==
 +[http://www.astro.caltech.edu/~tjp/pgplot/subroutines.html#PGSCH PGSCH]
 + 
 +==Code Example==
 +<code><pre>
 +#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;
 +}
 + 
 +</pre></code>
 +[[S2PLOT:Function List | Back]] to S2PLOT function list.
 +__NOTOC__
 +__NOEDITSECTION__

Current revision

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