Module: Pgplot

Defined in:
ext/rb_pgplot.c

Defined Under Namespace

Classes: PgCursor

Constant Summary collapse

VERSION =
rb_str_new2(RUBY_PGPLOT_VERSION)

Class Method Summary collapse

Class Method Details

.pgarro(arg0, arg1, arg2, arg3) ⇒ Object



1352
1353
1354
1355
1356
1357
1358
# File 'ext/rb_pgplot.c', line 1352

static VALUE
  rb_pgplot_pgarro(VALUE obj,VALUE arg0,VALUE arg1,VALUE arg2,VALUE arg3)
{
  
  cpgarro(NUM2DBL(arg0),NUM2DBL(arg1),NUM2DBL(arg2),NUM2DBL(arg3));
  return Qtrue;
}

.pgask(*args) ⇒ Object

PGASK – control new page prompting

pgask [true|false]


68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'ext/rb_pgplot.c', line 68

static VALUE
  rb_pgplot_pgask( int argc, VALUE *argv, VALUE self)
{
  VALUE vflag;

  rb_scan_args(argc, argv, "01", &vflag);

  if (RTEST(vflag))
    cpgask(1);
  else
    cpgask(0);
  return Qnil;
}

.pgaxis(*args) ⇒ Object

PGAXIS – draw an axis

pgaxis( x1, y1, x2, y2, v1, v2,

{opt, step, nsub, tickl, tickr, frac, disp, orient} )

Example:

pgaxis( 1, 1, 9, 5, 0, 3, "tickl"=>1, "opt"=>"NL2" )

 Draw a labelled graph axis from world-coordinate position (X1,Y1) to
 (X2,Y2).

 Normally, this routine draws a standard LINEAR axis with equal
 subdivisions.   The quantity described by the axis runs from V1 to V2;
 this may be, but need not be, the same as X or Y.

 If the 'L' option is specified, the routine draws a LOGARITHMIC axis.
 In this case, the quantity described by the axis runs from 10**V1 to
 10**V2. A logarithmic axis always has major, labeled, tick marks
 spaced by one or more decades. If the major tick marks are spaced
 by one decade (as specified by the STEP argument), then minor
 tick marks are placed at 2, 3, .., 9 times each power of 10;
 otherwise minor tick marks are spaced by one decade. If the axis
 spans less than two decades, numeric labels are placed at 1, 2, and
 5 times each power of ten.

 If the axis spans less than one decade, or if it spans many decades,
 it is preferable to use a linear axis labeled with the logarithm of
 the quantity of interest.

 Arguments:
  x1, y1  : world coordinates of one endpoint of the axis.
  x2, y2  : world coordinates of the other endpoint of the axis.
  v1      : axis value at first endpoint.
  v2      : axis value at second endpoint.

 Keyword Argnuments:
  opt     : a string containing single-letter codes for
      various options. The options currently
      recognized are:
      L : draw a logarithmic axis
      N : write numeric labels
      1 : force decimal labelling, instead of automatic
   	   choice (see PGNUMB).
      2 : force exponential labelling, instead of
   	   automatic.
  step    : major tick marks are drawn at axis value 0.0 plus
      or minus integer multiples of STEP. If STEP=0.0,
      a value is chosen automatically.
  nsub    : minor tick marks are drawn to divide the major
      divisions into NSUB equal subdivisions (ignored if
      STEP=0.0). If NSUB <= 1, no minor tick marks are
      drawn. NSUB is ignored for a logarithmic axis.
  tickl   : length of major tick marks drawn to left of axis
      (as seen looking from first endpoint to second), in
      units of the character height.
  tickr   : length of major tick marks drawn to right of axis,
      in units of the character height.
  frac    : length of minor tick marks, as fraction of major.
  disp    : displacement of baseline of tick labels to
      right of axis, in units of the character height.
  orient  : orientation of label text, in degrees; angle between

baseline of text and direction of axis (0-360



1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
# File 'ext/rb_pgplot.c', line 1172

static VALUE
  rb_pgplot_pgaxis( int argc, VALUE *argv, VALUE self )
{
  const char *opt="";
  float frac=0.5;
  VALUE val=Qnil;
  VALUE x1, y1, x2, y2, v1, v2;
  VALUE vopt, step, nsub, tickl, tickr, vfrac, disp, orient;

  if (argc>0 && TYPE(argv[argc-1]) == T_HASH)
    val = argv[--argc];

  rb_scan_kw_args( val,
		   "opt",&vopt, "step",&step, "nsub",&nsub,
		   "tickl",&tickl, "tickr",&tickr,
		   "frac",&vfrac, "disp",&disp, "orient",&orient, (char *)0);
  rb_scan_args(argc,argv, "60", &x1,&y1, &x2,&y2, &v1,&v2);

  if (step  ==Qnil)  step  = INT2FIX(0);
  if (nsub  ==Qnil)  nsub  = INT2FIX(0);
  if (tickl ==Qnil)  tickl = INT2FIX(0);
  if (tickr ==Qnil)  tickr = INT2FIX(0);
  if (disp  ==Qnil)  disp  = INT2FIX(1);
  if (orient==Qnil)  orient= INT2FIX(0);
  if (vopt  !=Qnil)  opt   = StringValuePtr(vopt);
  if (vfrac !=Qnil)  frac  = NUM2DBL(vfrac);

  cpgaxis( opt, NUM2DBL(x1),NUM2DBL(y1),NUM2DBL(x2),NUM2DBL(y2),
	   NUM2DBL(v1),NUM2DBL(v2),NUM2DBL(step),NUM2INT(nsub),
	   NUM2DBL(tickl),NUM2DBL(tickr), frac,
	   NUM2DBL(disp), NUM2DBL(orient) );
  return Qnil;
}

.pgband(*args) ⇒ Object

PGBAND – read cursor position, with anchor result = pgband( mode, [xref, yref, [x, y, [posn]]] )

PgCursorError is raised if some error occurs.

result : instance of PgCursor-class. see pgcurs.



918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
# File 'ext/rb_pgplot.c', line 918

static VALUE
  rb_pgplot_pgband( int argc, VALUE *argv, VALUE self )
{
  int   mode=0, posn=0;
  float x, y, xr, yr;
  char  ch[2] = " ";

  if (argc<5) {
    cpgqwin(&x,&xr,&y,&yr);
    xr = x = (x+xr)/2;
    yr = y = (y+yr)/2;
  }
  switch (argc) {
  case 6:
    if (RTEST(argv[5])) {
      if (argv[5]==Qtrue)
	posn = 1;
      else
	posn = NUM2INT(argv[5]);
    }
  case 5:
    x  = NUM2DBL(argv[3]);
    y  = NUM2DBL(argv[4]);
  case 3:
    xr = NUM2DBL(argv[1]);
    yr = NUM2DBL(argv[2]);
  case 1:
    mode = NUM2INT(argv[0]);
    break;
  default:
    rb_raise(rb_eArgError, "wrong # of arguments (%d for 1/3/5)", argc);
  }

  if (!cpgband(mode, posn, xr, yr, &x, &y, ch))
    rb_raise(ePgCursorError, "failure in getting cursor position");

  return pgcursor_new( rb_float_new(x), rb_float_new(y),
		       (ch[0]==0) ? Qnil : rb_str_new(ch,1) );
}

.pgbbufObject



1216
1217
1218
1219
1220
1221
1222
# File 'ext/rb_pgplot.c', line 1216

static VALUE
  rb_pgplot_pgbbuf(VALUE obj)
{
  
  cpgbbuf();
  return Qtrue;
}

.pgbeg(*args) ⇒ Object

PGBEG – open a graphics device



100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
# File 'ext/rb_pgplot.c', line 100

static VALUE
  rb_pgplot_pgbeg( int argc, VALUE *argv, VALUE self )
{
  VALUE  vdev, vnxs, vnys;
  int    nxsub=1, nysub=1;
  const char  *dev="?";

  rb_scan_args(argc, argv, "03", &vdev,&vnxs,&vnys);
  if (vdev!=Qnil) dev  = StringValuePtr(vdev);
  if (vnxs!=Qnil) nxsub = NUM2INT(vnxs);
  if (vnys!=Qnil) nysub = NUM2INT(vnys);

  if (cpgbeg(0, dev, nxsub, nysub) != 1)
    return Qnil;
  else
    return Qtrue;
}

.pgbin(*args) ⇒ Object

PGBIN – histogram of binned data

pgbin xarray, yarray [,center]
x      : abscissae of bins.
y      : data values of bins.
center : if true, the X values denote the center of the bin;
         if false, the X values denote the lower edge (in X) of the bin.


223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
# File 'ext/rb_pgplot.c', line 223

static VALUE
  rb_pgplot_pgbin( int argc, VALUE *argv, VALUE self )
{
  VALUE vx, vy, vcent;
  VALUE x, y;
  int cent;

  rb_scan_args(argc,argv, "21", &vx,&vy,&vcent);
  if (RTEST(vcent)) cent=1; else cent=0;

  x = rb_pgplot_fltary( vx );
  y = rb_pgplot_fltary( vy );

  cpgbin( min(NA_TOTAL(x),NA_TOTAL(y)), NA_PTR_FLT(x), NA_PTR_FLT(y), cent );

  return Qtrue;
}

.pgbox(arg0, arg1, arg2, arg3, arg4, arg5) ⇒ Object



1272
1273
1274
1275
1276
1277
1278
# File 'ext/rb_pgplot.c', line 1272

static VALUE
  rb_pgplot_pgbox(VALUE obj,VALUE arg0,VALUE arg1,VALUE arg2,VALUE arg3,VALUE arg4,VALUE arg5)
{
  
  cpgbox(StringValuePtr(arg0),NUM2DBL(arg1),NUM2INT(arg2),StringValuePtr(arg3),NUM2DBL(arg4),NUM2INT(arg5));
  return Qtrue;
}

.pgcirc(arg0, arg1, arg2) ⇒ Object



1360
1361
1362
1363
1364
1365
1366
# File 'ext/rb_pgplot.c', line 1360

static VALUE
  rb_pgplot_pgcirc(VALUE obj,VALUE arg0,VALUE arg1,VALUE arg2)
{
  
  cpgcirc(NUM2DBL(arg0),NUM2DBL(arg1),NUM2DBL(arg2));
  return Qtrue;
}

.pgclosObject



1264
1265
1266
1267
1268
1269
1270
# File 'ext/rb_pgplot.c', line 1264

static VALUE
  rb_pgplot_pgclos(VALUE obj)
{
  
  cpgclos();
  return Qtrue;
}

.pgconb(*args) ⇒ Object

PGCONB – contour map of a 2D data array, with blanking

pgconb, map, cont [, blank, tr]
map   : 2-D array of map data
cont  : array of contour levels
tr    : transformation matrix
blank : elements of array A that are equal to this value are blanked.


467
468
469
470
471
472
# File 'ext/rb_pgplot.c', line 467

static VALUE
  rb_pgplot_pgconb( int argc, VALUE *argv, VALUE self )
{
  rb_pgplot_contour( argc, argv, 2 );
  return Qtrue;
}

.pgconf(*args) ⇒ Object

PGCONF – fill between two contours

pgconf, map, cont_range [,tr]
map        : 2-D array of map data
cont_range : range of two contour levels
tr         : transformation matrix


480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
# File 'ext/rb_pgplot.c', line 480

static VALUE
  rb_pgplot_pgconf( int argc, VALUE *argv, VALUE self )
{
  VALUE vmap, vtr, vcont;
  VALUE na_map;
  float crange[2], *tr;

  rb_scan_args(argc, argv, "21", &vmap, &vcont, &vtr );

  /* Map Data */
  na_map = rb_pgplot_fltary( vmap );
  if (NA_RANK(na_map) != 2)
    rb_raise(rb_eArgError, "Image must be 2-D (N)Array");
  /* Contour range */
  rb_pgplot_find_range( na_map, vcont, crange );
  /* Transform */
  tr = rb_pgplot_transform( vtr );
  /* Show Contour */
  cpgconf( NA_PTR_FLT(na_map), NA_SHAPE0(na_map), NA_SHAPE1(na_map),
	   1, NA_SHAPE0(na_map), 1, NA_SHAPE1(na_map),
	   crange[0], crange[1], tr );
  return Qtrue;
}

.pgconl(*args) ⇒ Object

PGCONL – label contour map of a 2D data array

pgconl, map, cont, label [,intval, minint, tr]
map    : 2-D array of map data
cont   : contour level tobe labeld
label  : label string
intval : spacing along the contour between labels, in grid cells.
minint : contours that cross less than MININT cells will not be labelled.
tr     : transformation matrix


513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
# File 'ext/rb_pgplot.c', line 513

static VALUE
  rb_pgplot_pgconl( int argc, VALUE *argv, VALUE self )
{
  VALUE vmap, vcnt, vlab, vint, vmin, vtr;
  VALUE na_map;
  float *tr;
  int intval=20, minint=10; /* recomended default */

  rb_scan_args(argc, argv, "33", &vmap,&vcnt,&vlab,&vint,&vmin,&vtr );

  /* Map Data */
  na_map = rb_pgplot_fltary( vmap );
  if (NA_RANK(na_map) != 2)
    rb_raise(rb_eArgError, "Image must be 2-D (N)Array");
  /* spacing of labels */
  if (vint!=Qnil) intval = NUM2INT(vint);
  if (vmin!=Qnil) minint = NUM2INT(vmin);
  /* Transform */
  tr = rb_pgplot_transform( vtr );
  /* Show Contour */
  cpgconl( NA_PTR_FLT(na_map), NA_SHAPE0(na_map), NA_SHAPE1(na_map),
	   1, NA_SHAPE0(na_map), 1, NA_SHAPE1(na_map),
	   NUM2DBL(vcnt), tr, StringValuePtr(vlab), intval, minint);
  return Qtrue;
}

.pgcons(*args) ⇒ Object

PGCONS – contour map of a 2D data array (fast algorithm)

pgcons, map, cont [,tr]
map   : 2-D array of map data
cont  : array of contour levels
tr    : transformation matrix


454
455
456
457
458
459
# File 'ext/rb_pgplot.c', line 454

static VALUE
  rb_pgplot_pgcons( int argc, VALUE *argv, VALUE self )
{
  rb_pgplot_contour( argc, argv, 1 );
  return Qtrue;
}

.pgcont(*args) ⇒ Object

PGCONT – contour map of a 2D data array (contour-following)

pgcont, map, cont [,tr]
map   : 2-D array of map data
cont  : array of contour levels
tr    : transformation matrix between array grid and world coordinates.


442
443
444
445
446
447
# File 'ext/rb_pgplot.c', line 442

static VALUE
  rb_pgplot_pgcont( int argc, VALUE *argv, VALUE self )
{
  rb_pgplot_contour( argc, argv, 0 );
  return Qtrue;
}

.pgctab(*args) ⇒ Object

PGCTAB – install the color table to be used by PGIMAG

pgctab, l,r,g,b [,contra,bright]
l       : An array of NC normalized ramp-intensity levels
          corresponding to the RGB primary color intensities
          in R(),G(),B(). Colors on the ramp are linearly
          interpolated from neighbouring levels.
          Levels must be sorted in increasing order.
           0.0 places a color at the beginning of the ramp.
           1.0 places a color at the end of the ramp.
          Colors outside these limits are legal, but will
          not be visible if CONTRA=1.0 and BRIGHT=0.5.
r,g,b   : array of normalized red,green,blue intensities.
contra  : The contrast of the color ramp (normally 1.0).
          Negative values reverse the direction of the ramp.
bright  : The brightness of the color ramp. This is normally 0.5
          but can sensibly hold any value between 0.0 and 1.0.


674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
# File 'ext/rb_pgplot.c', line 674

static VALUE
  rb_pgplot_pgctab( int argc, VALUE *argv, VALUE self )
{
  VALUE vl, vr, vg, vb, vcnt, vbrt;
  VALUE l, r, g, b;
  float contra=1.0, bright=0.5;
  int n;

  rb_scan_args(argc,argv, "42", &vl,&vr,&vg,&vb,&vcnt,&vbrt);

  l = rb_pgplot_fltary( vl );
  r = rb_pgplot_fltary( vr );
  g = rb_pgplot_fltary( vg );
  b = rb_pgplot_fltary( vb );

  /* Optional Args */
  if (vcnt!=Qnil) contra = NUM2INT(vcnt);
  if (vbrt!=Qnil) bright = NUM2INT(vbrt);

  n = min(NA_TOTAL(l),NA_TOTAL(r));
  n = min(NA_TOTAL(g),n);
  n = min(NA_TOTAL(b),n);
  cpgctab( NA_PTR_FLT(l), NA_PTR_FLT(r), NA_PTR_FLT(g), NA_PTR_FLT(b),
	   n, contra, bright);
  return Qtrue;
}

.pgcurs(*args) ⇒ Object

PGCURS – read cursor position result = pgcurs()

PgCursorError is raised if some error occurs.

result : instance of PgCursor-class. Attrs are; x : the world x-coordinate of the cursor. y : the world y-coordinate of the cursor. char : the character typed by the user; nil if the device has no cursor or if some other error occurs.



883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
# File 'ext/rb_pgplot.c', line 883

static VALUE
  rb_pgplot_pgcurs( int argc, VALUE *argv, VALUE self )
{
  float x, y, x2, y2;
  char  ch[2] = " ";

  switch (argc) {
  case 0:
    cpgqwin(&x,&x2,&y,&y2);
    x = (x+x2)/2;
    y = (y+y2)/2;
    break;
  case 2:
    x = NUM2DBL(argv[0]);
    y = NUM2DBL(argv[1]);
    break;
  default:
    rb_raise(rb_eArgError, "wrong # of arguments (%d for 0 or 2)", argc);
  }

  if (!cpgcurs(&x, &y, ch))
    rb_raise(ePgCursorError, "failure in getting cursor position");

  return pgcursor_new( rb_float_new(x), rb_float_new(y),
		       (ch[0]==0) ? Qnil : rb_str_new(ch,1) );
}

.pgdraw(arg0, arg1) ⇒ Object



1328
1329
1330
1331
1332
1333
1334
# File 'ext/rb_pgplot.c', line 1328

static VALUE
  rb_pgplot_pgdraw(VALUE obj,VALUE arg0,VALUE arg1)
{
  
  cpgdraw(NUM2DBL(arg0),NUM2DBL(arg1));
  return Qtrue;
}

.pgebufObject



1224
1225
1226
1227
1228
1229
1230
# File 'ext/rb_pgplot.c', line 1224

static VALUE
  rb_pgplot_pgebuf(VALUE obj)
{
  
  cpgebuf();
  return Qtrue;
}

.pgendObject



1208
1209
1210
1211
1212
1213
1214
# File 'ext/rb_pgplot.c', line 1208

static VALUE
  rb_pgplot_pgend(VALUE obj)
{
  
  cpgend();
  return Qtrue;
}

.pgenv(*args) ⇒ Object

PGENV – set window and viewport and draw labeled frame

pgenv xmin,xmax,ymin,ymax [, just [, axis]]
  xmin: the left of the viewport.
  xmax: the right of the viewport.
  ymin: the bottom of the viewport.
  ymax: the top of the viewport
  just: if just=1, the x and y axes is scaled equally,
        otherwise scaled independently.
  axis: controls of axes.


129
130
131
132
133
134
135
136
137
138
139
140
141
# File 'ext/rb_pgplot.c', line 129

static VALUE
  rb_pgplot_pgenv( int argc, VALUE *argv, VALUE self )
{
  VALUE x0, x1, y0, y1, vjust, vaxis;
  int   just=0, axis=0;

  rb_scan_args(argc, argv, "42", &x0,&x1,&y0,&y1,&vjust,&vaxis);
  if (vjust!=Qnil) just = NUM2INT(vjust);
  if (vaxis!=Qnil) axis = NUM2INT(vaxis);

  cpgenv( NUM2DBL(x0), NUM2DBL(x1), NUM2DBL(y0), NUM2DBL(y1), just, axis );
  return Qtrue;
}

.pgerasObject



1456
1457
1458
1459
1460
1461
1462
# File 'ext/rb_pgplot.c', line 1456

static VALUE
  rb_pgplot_pgeras(VALUE obj)
{
  
  cpgeras();
  return Qtrue;
}

.pgerr1(arg0, arg1, arg2, arg3, arg4) ⇒ Object



1376
1377
1378
1379
1380
1381
1382
# File 'ext/rb_pgplot.c', line 1376

static VALUE
  rb_pgplot_pgerr1(VALUE obj,VALUE arg0,VALUE arg1,VALUE arg2,VALUE arg3,VALUE arg4)
{
  
  cpgerr1(NUM2INT(arg0),NUM2DBL(arg1),NUM2DBL(arg2),NUM2DBL(arg3),NUM2DBL(arg4));
  return Qtrue;
}

.pgerrb(*args) ⇒ Object

PGERRB – horizontal or vertical error bar

 pgerrb, dir, x, y, err [,tlen]

 dir : direction to plot the error bar relative to the data point.
       One-sided error bar:
         DIR is 1 for +X (X to X+E);
                2 for +Y (Y to Y+E);
                3 for -X (X to X-E);
                4 for -Y (Y to Y-E).
       Two-sided error bar:
         DIR is 5 for +/-X (X-E to X+E);
                6 for +/-Y (Y-E to Y+E).
 x   : world x-coordinates of the data.
 y   : world y-coordinates of the data.
 err : value of error bar distance to be added to the
       data position in world coordinates.
 tlen: length of terminals to be drawn at the ends of the error bar,
as a multiple of the default length.


329
330
331
332
333
334
# File 'ext/rb_pgplot.c', line 329

static VALUE
  rb_pgplot_pgerrb( int argc, VALUE *argv, VALUE self )
{
  rb_pgplot_errorbar( argc-1, argv+1, 0, NUM2INT(argv[0]) );
  return Qtrue;
}

.pgerrx(*args) ⇒ Object

PGERRX – horizontal error bar

pgerrx, x1, x2, y [,tlen]

x1 : world x-coordinates of lower end of the error bars.
x2 : world x-coordinates of upper end of the error bars.


342
343
344
345
346
347
# File 'ext/rb_pgplot.c', line 342

static VALUE
  rb_pgplot_pgerrx( int argc, VALUE *argv, VALUE self )
{
  rb_pgplot_errorbar( argc, argv, 1, 0 );
  return Qtrue;
}

.pgerry(*args) ⇒ Object

PGERRY – vertical error bar

pgerry, x, y1, y2 [,tlen]

y1 : world y-coordinates of top end of the error bars.
y2 : world y-coordinates of bottom end of the error bars.


355
356
357
358
359
360
# File 'ext/rb_pgplot.c', line 355

static VALUE
  rb_pgplot_pgerry( int argc, VALUE *argv, VALUE self )
{
  rb_pgplot_errorbar( argc, argv, 2, 0 );
  return Qtrue;
}

.pgetxtObject



1416
1417
1418
1419
1420
1421
1422
# File 'ext/rb_pgplot.c', line 1416

static VALUE
  rb_pgplot_pgetxt(VALUE obj)
{
  
  cpgetxt();
  return Qtrue;
}

.pggray(*args) ⇒ Object

PGGRAY – gray-scale map of a 2D data array

pggray, array [, range, tr]
range : range of array value to be drawn
TR    : transformation matrix.


649
650
651
652
653
654
# File 'ext/rb_pgplot.c', line 649

static VALUE
  rb_pgplot_pggray( int argc, VALUE *argv, VALUE self )
{
  rb_pgplot_mapimage( argc, argv, self, 1 );
  return Qtrue;
}

.pghist(*args) ⇒ Object

PGHIST – histogram of unbinned data

pghist, data, nbin [,range, flag]
data   : the data values. NBIN may not exceed 200.
nbin   : the number of bins to use
range  : the range for the histogram.
flag   : = 0 PGENV is called automatically
  = 1 the histogram is plotted in the current window.
  = 2,3 with a filled area style.
  = 4,5 simple line.


251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
# File 'ext/rb_pgplot.c', line 251

static VALUE
  rb_pgplot_pghist( int argc, VALUE *argv, VALUE self )
{
  VALUE vdat,vnbin,vrange,vflag;
  VALUE na_dat;
  int flag=0;
  float range[2];

  rb_scan_args(argc,argv, "22", &vdat,&vnbin,&vrange,&vflag);
  na_dat = rb_pgplot_fltary( vdat );

  /* Data Range */
  if (vrange!=Qnil) {
    range[0] = NUM2DBL(rb_funcall(vrange, id_beg, 0));
    range[1] = NUM2DBL(rb_funcall(vrange, id_end, 0));
  } else {
    rb_pgplot_minmax(na_dat,range);
  }
  /* PGFLAG */
  if (vflag!=Qnil) flag = NUM2INT(vflag);

  cpghist( NA_TOTAL(na_dat), NA_PTR_FLT(na_dat),
	   range[0], range[1], NUM2INT(vnbin), flag );
  return Qtrue;
}

.pgidenObject



1424
1425
1426
1427
1428
1429
1430
# File 'ext/rb_pgplot.c', line 1424

static VALUE
  rb_pgplot_pgiden(VALUE obj)
{
  
  cpgiden();
  return Qtrue;
}

.pgimag(*args) ⇒ Object

PGIMAG – color image from a 2D data array

pgimag, array [,range ,tr]
range : range of array value to be drawn
TR    : transformation matrix.


638
639
640
641
642
643
# File 'ext/rb_pgplot.c', line 638

static VALUE
  rb_pgplot_pgimag( int argc, VALUE *argv, VALUE self )
{
  rb_pgplot_mapimage( argc, argv, self, 0 );
  return Qtrue;
}

.pglab(arg0, arg1, arg2) ⇒ Object



1384
1385
1386
1387
1388
1389
1390
# File 'ext/rb_pgplot.c', line 1384

static VALUE
  rb_pgplot_pglab(VALUE obj,VALUE arg0,VALUE arg1,VALUE arg2)
{
  
  cpglab(StringValuePtr(arg0),StringValuePtr(arg1),StringValuePtr(arg2));
  return Qtrue;
}

.pglcur(*args) ⇒ Object

PGLCUR – PGLCUR – draw a line using the cursor result = pglcur( x, y, [npt] )

x : NArray.sfloat of x-coordinates. y : NArray.sfloat of y-coordinates. npt : number of points entered; should be zero on first call.

result: number of points entered.



1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
# File 'ext/rb_pgplot.c', line 1029

static VALUE
  rb_pgplot_pglcur( int argc, VALUE *argv, VALUE self )
{
  VALUE x, y, vnpt;
  int npt=0;

  rb_scan_args(argc,argv, "21", &x,&y,&vnpt);
  if (vnpt!=Qnil) npt = NUM2INT(vnpt);

  if (NA_TYPE(x)!=NA_SFLOAT || NA_TYPE(y)!=NA_SFLOAT)
    rb_raise(rb_eArgError, "Array must NArray.sfloat");

  cpglcur( min(NA_TOTAL(x),NA_TOTAL(y)), &npt,
	   NA_PTR_FLT(x), NA_PTR_FLT(y) );

  return INT2NUM(npt);
}

.pgldevObject



1432
1433
1434
1435
1436
1437
1438
# File 'ext/rb_pgplot.c', line 1432

static VALUE
  rb_pgplot_pgldev(VALUE obj)
{
  
  cpgldev();
  return Qtrue;
}

.pgline(v1, v2) ⇒ Object

PGLINE – draw a polyline (curve defined by line-segments)

pgline xarray, yarray


147
148
149
150
151
152
153
154
155
156
157
158
# File 'ext/rb_pgplot.c', line 147

static VALUE
  rb_pgplot_pgline(VALUE obj, VALUE v1, VALUE v2)
{
  VALUE x, y;

  x = rb_pgplot_fltary( v1 );
  y = rb_pgplot_fltary( v2 );

  cpgline( min(NA_TOTAL(x),NA_TOTAL(y)), NA_PTR_FLT(x), NA_PTR_FLT(y) );

  return Qtrue;
}

.pgmove(arg0, arg1) ⇒ Object



1336
1337
1338
1339
1340
1341
1342
# File 'ext/rb_pgplot.c', line 1336

static VALUE
  rb_pgplot_pgmove(VALUE obj,VALUE arg0,VALUE arg1)
{
  
  cpgmove(NUM2DBL(arg0),NUM2DBL(arg1));
  return Qtrue;
}

.pgmtxt(arg0, arg1, arg2, arg3, arg4) ⇒ Object



1408
1409
1410
1411
1412
1413
1414
# File 'ext/rb_pgplot.c', line 1408

static VALUE
  rb_pgplot_pgmtxt(VALUE obj,VALUE arg0,VALUE arg1,VALUE arg2,VALUE arg3,VALUE arg4)
{
  
  cpgmtxt(StringValuePtr(arg0),NUM2DBL(arg1),NUM2DBL(arg2),NUM2DBL(arg3),StringValuePtr(arg4));
  return Qtrue;
}

.pgncur(*args) ⇒ Object

PGNCUR – mark a set of points using the cursor result = pgncur( x, y, [sym, [npt]] )

x : NArray.sfloat of x-coordinates. y : NArray.sfloat of y-coordinates. sym : code number of symbol to use for marking entered points (see PGPT). npt : number of points entered; should be zero on first call.

result: number of points entered.



1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
# File 'ext/rb_pgplot.c', line 1000

static VALUE
  rb_pgplot_pgncur( int argc, VALUE *argv, VALUE self )
{
  VALUE x, y, vsym, vnpt;
  int sym=0, npt=0;

  rb_scan_args(argc,argv, "22", &x,&y,&vsym,&vnpt);
  if (vsym!=Qnil) sym = NUM2INT(vsym);
  if (vnpt!=Qnil) npt = NUM2INT(vnpt);

  if (NA_TYPE(x)!=NA_SFLOAT || NA_TYPE(y)!=NA_SFLOAT)
    rb_raise(rb_eArgError, "Array must NArray.sfloat");

  cpgncur( min(NA_TOTAL(x),NA_TOTAL(y)), &npt,
	   NA_PTR_FLT(x), NA_PTR_FLT(y), sym );

  return INT2NUM(npt);
}

.pgolin(*args) ⇒ Object

PGOLIN – mark a set of points using the cursor result = pgolin( x, y, [sym, [npt]] )

x : NArray.sfloat of x-coordinates. y : NArray.sfloat of y-coordinates. sym : code number of symbol to use for marking entered points (see PGPT). npt : number of points entered; should be zero on first call.

result: number of points entered.



970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
# File 'ext/rb_pgplot.c', line 970

static VALUE
  rb_pgplot_pgolin( int argc, VALUE *argv, VALUE self )
{
  VALUE x, y, vsym, vnpt;
  int sym=0, npt=0;

  rb_scan_args(argc,argv, "22", &x,&y,&vsym,&vnpt);
  if (vsym!=Qnil) sym = NUM2INT(vsym);
  if (vnpt!=Qnil) npt = NUM2INT(vnpt);

  if (NA_TYPE(x)!=NA_SFLOAT || NA_TYPE(y)!=NA_SFLOAT)
    rb_raise(rb_eArgError, "Array must NArray.sfloat");

  cpgolin( min(NA_TOTAL(x),NA_TOTAL(y)), &npt,
	   NA_PTR_FLT(x), NA_PTR_FLT(y), sym );

  return INT2NUM(npt);
}

.pgopen(*args) ⇒ Object

PGOPEN – open a graphics device

stat = pgopen [device]


86
87
88
89
90
91
92
93
94
95
96
# File 'ext/rb_pgplot.c', line 86

static VALUE
  rb_pgplot_pgopen( int argc, VALUE *argv, VALUE self )
{
  VALUE vdev;
  const char *dev="?";

  rb_scan_args(argc,argv, "01", &vdev);
  if (vdev!=Qnil) dev = StringValuePtr(vdev);

  return INT2NUM(cpgopen(dev));
}

.pgpageObject



1232
1233
1234
1235
1236
1237
1238
# File 'ext/rb_pgplot.c', line 1232

static VALUE
  rb_pgplot_pgpage(VALUE obj)
{
  
  cpgpage();
  return Qtrue;
}

.pgpanl(arg0, arg1) ⇒ Object



1256
1257
1258
1259
1260
1261
1262
# File 'ext/rb_pgplot.c', line 1256

static VALUE
  rb_pgplot_pgpanl(VALUE obj,VALUE arg0,VALUE arg1)
{
  
  cpgpanl(NUM2DBL(arg0),NUM2DBL(arg1));
  return Qtrue;
}

.pgpap(arg0, arg1) ⇒ Object



1240
1241
1242
1243
1244
1245
1246
# File 'ext/rb_pgplot.c', line 1240

static VALUE
  rb_pgplot_pgpap(VALUE obj,VALUE arg0,VALUE arg1)
{
  
  cpgpap(NUM2DBL(arg0),NUM2DBL(arg1));
  return Qtrue;
}

.pgpixl(*args) ⇒ Object

PGPIXL – draw pixels pgpixl, array [,x1,x2,y1,y2]

x1, y1 : world coordinates of one corner of the output region x2, y2 : world coordinates of the opposite corner of the output region



733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
# File 'ext/rb_pgplot.c', line 733

static VALUE
  rb_pgplot_pgpixl( int argc, VALUE *argv, VALUE self )
{
  VALUE na;
  float x1, x2, y1, y2;

  if (argc<1)
    rb_raise(rb_eArgError, "wrong # of arguments (%d for 1 or 5)", argc);
  na = rb_pgplot_intary(argv[0]);

  if (NA_RANK(na) != 2)
    rb_raise(rb_eArgError, "Image must be 2-D (N)Array");

  if (argc==5) {
    x1 = NUM2DBL(argv[1]);
    x2 = NUM2DBL(argv[2]);
    y1 = NUM2DBL(argv[3]);
    y2 = NUM2DBL(argv[4]);
  } else if (argc==1) {
    x1 = 0;
    x2 = NA_SHAPE0(na);
    y1 = 0;
    y2 = NA_SHAPE1(na);
  } else
    rb_raise(rb_eArgError, "wrong # of arguments (%d for 1 or 5)", argc);

  cpgpixl( NA_PTR_INT(na), NA_SHAPE0(na), NA_SHAPE1(na),
	   1, NA_SHAPE0(na), 1, NA_SHAPE1(na),
	   x1, x2, y1, y2 );
  return Qtrue;
}

.pgpnts(vx, vy, vs) ⇒ Object

PGPNTS – draw several graph markers, not all the same

pgpnts xarray, yarray, symarray


201
202
203
204
205
206
207
208
209
210
211
212
213
214
# File 'ext/rb_pgplot.c', line 201

static VALUE
  rb_pgplot_pgpnts( VALUE obj, VALUE vx, VALUE vy, VALUE vs )
{
  VALUE x, y, s;

  x = rb_pgplot_fltary( vx );
  y = rb_pgplot_fltary( vy );
  s = rb_pgplot_intary( vs );

  cpgpnts( min(NA_TOTAL(x),NA_TOTAL(y)), NA_PTR_FLT(x), NA_PTR_FLT(y),
	   NA_PTR_INT(s), NA_TOTAL(s) );

  return Qtrue;
}

.pgpoly(v1, v2) ⇒ Object

PGPOLY – draw a polygon, using fill-area attributes

pgpoly xarray, yarray


163
164
165
166
167
168
169
170
171
172
173
174
# File 'ext/rb_pgplot.c', line 163

static VALUE
  rb_pgplot_pgpoly(VALUE obj, VALUE v1, VALUE v2)
{
  VALUE x, y;

  x = rb_pgplot_fltary( v1 );
  y = rb_pgplot_fltary( v2 );

  cpgpoly( min(NA_TOTAL(x),NA_TOTAL(y)), NA_PTR_FLT(x), NA_PTR_FLT(y) );

  return Qtrue;
}

.pgpt(*args) ⇒ Object

PGPT – draw several graph markers

pgpt xarray, yarray [,symbol]


180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
# File 'ext/rb_pgplot.c', line 180

static VALUE
  rb_pgplot_pgpt( int argc, VALUE *argv, VALUE self )
{
  VALUE vx, vy, vsym;
  VALUE x, y;
  int sym=0;

  rb_scan_args(argc,argv, "21", &vx,&vy,&vsym);
  if (vsym!=Qnil) sym = NUM2INT(vsym);

  x = rb_pgplot_fltary( vx );
  y = rb_pgplot_fltary( vy );

  cpgpt( min(NA_TOTAL(x),NA_TOTAL(y)), NA_PTR_FLT(x), NA_PTR_FLT(y), sym );

  return Qtrue;
}

.pgpt1(arg0, arg1, arg2) ⇒ Object



1368
1369
1370
1371
1372
1373
1374
# File 'ext/rb_pgplot.c', line 1368

static VALUE
  rb_pgplot_pgpt1(VALUE obj,VALUE arg0,VALUE arg1,VALUE arg2)
{
  
  cpgpt1(NUM2DBL(arg0),NUM2DBL(arg1),NUM2INT(arg2));
  return Qtrue;
}

.pgptxt(arg0, arg1, arg2, arg3, arg4) ⇒ Object



1392
1393
1394
1395
1396
1397
1398
# File 'ext/rb_pgplot.c', line 1392

static VALUE
  rb_pgplot_pgptxt(VALUE obj,VALUE arg0,VALUE arg1,VALUE arg2,VALUE arg3,VALUE arg4)
{
  
  cpgptxt(NUM2DBL(arg0),NUM2DBL(arg1),NUM2DBL(arg2),NUM2DBL(arg3),StringValuePtr(arg4));
  return Qtrue;
}

.pgqcfObject



1624
1625
1626
1627
1628
1629
1630
# File 'ext/rb_pgplot.c', line 1624

static VALUE
  rb_pgplot_pgqcf(VALUE obj)
{
  int var0;
  cpgqcf(&var0);
  return INT2NUM(var0);
}

.pgqchObject



1616
1617
1618
1619
1620
1621
1622
# File 'ext/rb_pgplot.c', line 1616

static VALUE
  rb_pgplot_pgqch(VALUE obj)
{
  float var0;
  cpgqch(&var0);
  return rb_float_new(var0);
}

.pgqciObject



1632
1633
1634
1635
1636
1637
1638
# File 'ext/rb_pgplot.c', line 1632

static VALUE
  rb_pgplot_pgqci(VALUE obj)
{
  int var0;
  cpgqci(&var0);
  return INT2NUM(var0);
}

.pgqcirObject



1744
1745
1746
1747
1748
1749
1750
# File 'ext/rb_pgplot.c', line 1744

static VALUE
  rb_pgplot_pgqcir(VALUE obj)
{
  int var0;int var1;
  cpgqcir(&var0,&var1);
  return rb_ary_new3(2,INT2NUM(var0),INT2NUM(var1));
}

.pgqclpObject



1672
1673
1674
1675
1676
1677
1678
# File 'ext/rb_pgplot.c', line 1672

static VALUE
  rb_pgplot_pgqclp(VALUE obj)
{
  int var0;
  cpgqclp(&var0);
  return INT2NUM(var0);
}

.pgqcolObject



1736
1737
1738
1739
1740
1741
1742
# File 'ext/rb_pgplot.c', line 1736

static VALUE
  rb_pgplot_pgqcol(VALUE obj)
{
  int var0;int var1;
  cpgqcol(&var0,&var1);
  return rb_ary_new3(2,INT2NUM(var0),INT2NUM(var1));
}

.pgqcr(arg0) ⇒ Object



1712
1713
1714
1715
1716
1717
1718
# File 'ext/rb_pgplot.c', line 1712

static VALUE
  rb_pgplot_pgqcr(VALUE obj,VALUE arg0)
{
  float var0;float var1;float var2;
  cpgqcr(NUM2INT(arg0),&var0,&var1,&var2);
  return rb_ary_new3(3,rb_float_new(var0),rb_float_new(var1),rb_float_new(var2));
}

.pgqcs(arg0) ⇒ Object



1640
1641
1642
1643
1644
1645
1646
# File 'ext/rb_pgplot.c', line 1640

static VALUE
  rb_pgplot_pgqcs(VALUE obj,VALUE arg0)
{
  float var0;float var1;
  cpgqcs(NUM2INT(arg0),&var0,&var1);
  return rb_ary_new3(2,rb_float_new(var0),rb_float_new(var1));
}

.pgqdt(*args) ⇒ Object

PGQDT – inquire name of nth available device type

type, descr, inter = pgqdt [,ndev]
ndev  : the number of the device type (1..maximum).
type  : receives the character device-type code of the
        Nth device type.
descr : receives a description of the device type.
inter : receives 1 if the device type is an interactive
        one, 0 otherwise.


794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
# File 'ext/rb_pgplot.c', line 794

static VALUE
  rb_pgplot_pgqdt( int argc, VALUE *argv, VALUE self )
{
  VALUE vdev;
  int   ndev=1, type_len=9, descr_len=65, inter;
  char *type, *descr;

  type  = ALLOCA_N(char,type_len);
  descr = ALLOCA_N(char,descr_len);
  rb_scan_args(argc, argv, "01", &vdev);
  if (vdev!=Qnil) ndev = NUM2INT(vdev);
  cpgqdt( ndev, type, &type_len, descr, &descr_len, &inter );

  return rb_ary_new3( 3, rb_str_new(type,type_len),
		      rb_str_new(descr,descr_len),
		      INT2NUM(inter) );
}

.pgqfsObject



1648
1649
1650
1651
1652
1653
1654
# File 'ext/rb_pgplot.c', line 1648

static VALUE
  rb_pgplot_pgqfs(VALUE obj)
{
  int var0;
  cpgqfs(&var0);
  return INT2NUM(var0);
}

.pgqidObject



1680
1681
1682
1683
1684
1685
1686
# File 'ext/rb_pgplot.c', line 1680

static VALUE
  rb_pgplot_pgqid(VALUE obj)
{
  int var0;
  cpgqid(&var0);
  return INT2NUM(var0);
}

.pgqinf(vitem) ⇒ Object

PGQINF – inquire PGPLOT general information

value = pgqinf item
item  : character string defining the information
value : character string containing the requested information.


772
773
774
775
776
777
778
779
780
781
782
783
# File 'ext/rb_pgplot.c', line 772

static VALUE
  rb_pgplot_pgqinf( VALUE obj, VALUE vitem )
{
  int   value_len=20;
  char *item, *value;

  item  = StringValuePtr(vitem);
  value = ALLOCA_N(char,value_len);
  cpgqinf( item, value, &value_len );

  return rb_str_new(value,value_len);
}

.pgqitfObject



1688
1689
1690
1691
1692
1693
1694
# File 'ext/rb_pgplot.c', line 1688

static VALUE
  rb_pgplot_pgqitf(VALUE obj)
{
  int var0;
  cpgqitf(&var0);
  return INT2NUM(var0);
}

.pgqlsObject



1656
1657
1658
1659
1660
1661
1662
# File 'ext/rb_pgplot.c', line 1656

static VALUE
  rb_pgplot_pgqls(VALUE obj)
{
  int var0;
  cpgqls(&var0);
  return INT2NUM(var0);
}

.pgqlwObject



1664
1665
1666
1667
1668
1669
1670
# File 'ext/rb_pgplot.c', line 1664

static VALUE
  rb_pgplot_pgqlw(VALUE obj)
{
  int var0;
  cpgqlw(&var0);
  return INT2NUM(var0);
}

.pgqndtObject



1696
1697
1698
1699
1700
1701
1702
# File 'ext/rb_pgplot.c', line 1696

static VALUE
  rb_pgplot_pgqndt(VALUE obj)
{
  int var0;
  cpgqndt(&var0);
  return INT2NUM(var0);
}

.pgqposObject



1752
1753
1754
1755
1756
1757
1758
# File 'ext/rb_pgplot.c', line 1752

static VALUE
  rb_pgplot_pgqpos(VALUE obj)
{
  float var0;float var1;
  cpgqpos(&var0,&var1);
  return rb_ary_new3(2,rb_float_new(var0),rb_float_new(var1));
}

.pgqtbgObject



1704
1705
1706
1707
1708
1709
1710
# File 'ext/rb_pgplot.c', line 1704

static VALUE
  rb_pgplot_pgqtbg(VALUE obj)
{
  int var0;
  cpgqtbg(&var0);
  return INT2NUM(var0);
}

.pgqtxt(x, y, ang, fjust, text) ⇒ Object

PGQTXT – find bounding box of text string

xbox, ybox = pgqtxt(x,y,angle,fjust,text)


816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
# File 'ext/rb_pgplot.c', line 816

static VALUE
  rb_pgplot_pgqtxt(VALUE obj, VALUE x, VALUE y,
		   VALUE ang, VALUE fjust, VALUE text)
{
  VALUE vx,vy;
  int i;
  float xbox[4], ybox[4];
  char *txt = StringValuePtr(text);

  cpgqtxt( NUM2DBL(x),NUM2DBL(y),NUM2DBL(ang),NUM2DBL(fjust),txt,
	   xbox, ybox );
  vx = rb_ary_new2(4);
  vy = rb_ary_new2(4);
  for (i=0;i<4;i++) {
    rb_ary_push(vx, rb_float_new(xbox[i]));
    rb_ary_push(vy, rb_float_new(ybox[i]));
  }
  return rb_ary_new3(2,vx,vy);
}

.pgqvp(arg0) ⇒ Object



1720
1721
1722
1723
1724
1725
1726
# File 'ext/rb_pgplot.c', line 1720

static VALUE
  rb_pgplot_pgqvp(VALUE obj,VALUE arg0)
{
  float var0;float var1;float var2;float var3;
  cpgqvp(NUM2INT(arg0),&var0,&var1,&var2,&var3);
  return rb_ary_new3(4,rb_float_new(var0),rb_float_new(var1),rb_float_new(var2),rb_float_new(var3));
}

.pgqvsz(arg0) ⇒ Object



1760
1761
1762
1763
1764
1765
1766
# File 'ext/rb_pgplot.c', line 1760

static VALUE
  rb_pgplot_pgqvsz(VALUE obj,VALUE arg0)
{
  float var0;float var1;float var2;float var3;
  cpgqvsz(NUM2INT(arg0),&var0,&var1,&var2,&var3);
  return rb_ary_new3(4,rb_float_new(var0),rb_float_new(var1),rb_float_new(var2),rb_float_new(var3));
}

.pgqwinObject



1728
1729
1730
1731
1732
1733
1734
# File 'ext/rb_pgplot.c', line 1728

static VALUE
  rb_pgplot_pgqwin(VALUE obj)
{
  float var0;float var1;float var2;float var3;
  cpgqwin(&var0,&var1,&var2,&var3);
  return rb_ary_new3(4,rb_float_new(var0),rb_float_new(var1),rb_float_new(var2),rb_float_new(var3));
}

.pgrect(arg0, arg1, arg2, arg3) ⇒ Object



1344
1345
1346
1347
1348
1349
1350
# File 'ext/rb_pgplot.c', line 1344

static VALUE
  rb_pgplot_pgrect(VALUE obj,VALUE arg0,VALUE arg1,VALUE arg2,VALUE arg3)
{
  
  cpgrect(NUM2DBL(arg0),NUM2DBL(arg1),NUM2DBL(arg2),NUM2DBL(arg3));
  return Qtrue;
}

.pgsah(arg0, arg1, arg2) ⇒ Object



1560
1561
1562
1563
1564
1565
1566
# File 'ext/rb_pgplot.c', line 1560

static VALUE
  rb_pgplot_pgsah(VALUE obj,VALUE arg0,VALUE arg1,VALUE arg2)
{
  
  cpgsah(NUM2INT(arg0),NUM2DBL(arg1),NUM2DBL(arg2));
  return Qtrue;
}

.pgsaveObject



1440
1441
1442
1443
1444
1445
1446
# File 'ext/rb_pgplot.c', line 1440

static VALUE
  rb_pgplot_pgsave(VALUE obj)
{
  
  cpgsave();
  return Qtrue;
}

.pgscf(arg0) ⇒ Object



1472
1473
1474
1475
1476
1477
1478
# File 'ext/rb_pgplot.c', line 1472

static VALUE
  rb_pgplot_pgscf(VALUE obj,VALUE arg0)
{
  
  cpgscf(NUM2INT(arg0));
  return Qtrue;
}

.pgsch(arg0) ⇒ Object



1464
1465
1466
1467
1468
1469
1470
# File 'ext/rb_pgplot.c', line 1464

static VALUE
  rb_pgplot_pgsch(VALUE obj,VALUE arg0)
{
  
  cpgsch(NUM2DBL(arg0));
  return Qtrue;
}

.pgsci(arg0) ⇒ Object



1480
1481
1482
1483
1484
1485
1486
# File 'ext/rb_pgplot.c', line 1480

static VALUE
  rb_pgplot_pgsci(VALUE obj,VALUE arg0)
{
  
  cpgsci(NUM2INT(arg0));
  return Qtrue;
}

.pgscir(arg0, arg1) ⇒ Object



1576
1577
1578
1579
1580
1581
1582
# File 'ext/rb_pgplot.c', line 1576

static VALUE
  rb_pgplot_pgscir(VALUE obj,VALUE arg0,VALUE arg1)
{
  
  cpgscir(NUM2INT(arg0),NUM2INT(arg1));
  return Qtrue;
}

.pgsclp(arg0) ⇒ Object



1512
1513
1514
1515
1516
1517
1518
# File 'ext/rb_pgplot.c', line 1512

static VALUE
  rb_pgplot_pgsclp(VALUE obj,VALUE arg0)
{
  
  cpgsclp(NUM2INT(arg0));
  return Qtrue;
}

.pgscr(arg0, arg1, arg2, arg3) ⇒ Object



1544
1545
1546
1547
1548
1549
1550
# File 'ext/rb_pgplot.c', line 1544

static VALUE
  rb_pgplot_pgscr(VALUE obj,VALUE arg0,VALUE arg1,VALUE arg2,VALUE arg3)
{
  
  cpgscr(NUM2INT(arg0),NUM2DBL(arg1),NUM2DBL(arg2),NUM2DBL(arg3));
  return Qtrue;
}

.pgscrl(arg0, arg1) ⇒ Object



1568
1569
1570
1571
1572
1573
1574
# File 'ext/rb_pgplot.c', line 1568

static VALUE
  rb_pgplot_pgscrl(VALUE obj,VALUE arg0,VALUE arg1)
{
  
  cpgscrl(NUM2DBL(arg0),NUM2DBL(arg1));
  return Qtrue;
}

.pgscrn(arg0, arg1) ⇒ Object



1584
1585
1586
1587
1588
1589
1590
# File 'ext/rb_pgplot.c', line 1584

static VALUE
  rb_pgplot_pgscrn(VALUE obj,VALUE arg0,VALUE arg1)
{
  int var0;
  cpgscrn(NUM2INT(arg0),StringValuePtr(arg1),&var0);
  return INT2NUM(var0);
}

.pgsfs(arg0) ⇒ Object



1488
1489
1490
1491
1492
1493
1494
# File 'ext/rb_pgplot.c', line 1488

static VALUE
  rb_pgplot_pgsfs(VALUE obj,VALUE arg0)
{
  
  cpgsfs(NUM2INT(arg0));
  return Qtrue;
}

.pgshls(arg0, arg1, arg2, arg3) ⇒ Object



1552
1553
1554
1555
1556
1557
1558
# File 'ext/rb_pgplot.c', line 1552

static VALUE
  rb_pgplot_pgshls(VALUE obj,VALUE arg0,VALUE arg1,VALUE arg2,VALUE arg3)
{
  
  cpgshls(NUM2INT(arg0),NUM2DBL(arg1),NUM2DBL(arg2),NUM2DBL(arg3));
  return Qtrue;
}

.pgshs(arg0, arg1, arg2) ⇒ Object



1592
1593
1594
1595
1596
1597
1598
# File 'ext/rb_pgplot.c', line 1592

static VALUE
  rb_pgplot_pgshs(VALUE obj,VALUE arg0,VALUE arg1,VALUE arg2)
{
  
  cpgshs(NUM2DBL(arg0),NUM2DBL(arg1),NUM2DBL(arg2));
  return Qtrue;
}

.pgsitf(arg0) ⇒ Object



1520
1521
1522
1523
1524
1525
1526
# File 'ext/rb_pgplot.c', line 1520

static VALUE
  rb_pgplot_pgsitf(VALUE obj,VALUE arg0)
{
  
  cpgsitf(NUM2INT(arg0));
  return Qtrue;
}

.pgslct(arg0) ⇒ Object



1528
1529
1530
1531
1532
1533
1534
# File 'ext/rb_pgplot.c', line 1528

static VALUE
  rb_pgplot_pgslct(VALUE obj,VALUE arg0)
{
  
  cpgslct(NUM2INT(arg0));
  return Qtrue;
}

.pgsls(arg0) ⇒ Object



1496
1497
1498
1499
1500
1501
1502
# File 'ext/rb_pgplot.c', line 1496

static VALUE
  rb_pgplot_pgsls(VALUE obj,VALUE arg0)
{
  
  cpgsls(NUM2INT(arg0));
  return Qtrue;
}

.pgslw(arg0) ⇒ Object



1504
1505
1506
1507
1508
1509
1510
# File 'ext/rb_pgplot.c', line 1504

static VALUE
  rb_pgplot_pgslw(VALUE obj,VALUE arg0)
{
  
  cpgslw(NUM2INT(arg0));
  return Qtrue;
}

.pgstbg(arg0) ⇒ Object



1536
1537
1538
1539
1540
1541
1542
# File 'ext/rb_pgplot.c', line 1536

static VALUE
  rb_pgplot_pgstbg(VALUE obj,VALUE arg0)
{
  
  cpgstbg(NUM2INT(arg0));
  return Qtrue;
}

.pgsubp(arg0, arg1) ⇒ Object



1312
1313
1314
1315
1316
1317
1318
# File 'ext/rb_pgplot.c', line 1312

static VALUE
  rb_pgplot_pgsubp(VALUE obj,VALUE arg0,VALUE arg1)
{
  
  cpgsubp(NUM2INT(arg0),NUM2INT(arg1));
  return Qtrue;
}

.pgsvp(arg0, arg1, arg2, arg3) ⇒ Object



1600
1601
1602
1603
1604
1605
1606
# File 'ext/rb_pgplot.c', line 1600

static VALUE
  rb_pgplot_pgsvp(VALUE obj,VALUE arg0,VALUE arg1,VALUE arg2,VALUE arg3)
{
  
  cpgsvp(NUM2DBL(arg0),NUM2DBL(arg1),NUM2DBL(arg2),NUM2DBL(arg3));
  return Qtrue;
}

.pgswin(arg0, arg1, arg2, arg3) ⇒ Object



1608
1609
1610
1611
1612
1613
1614
# File 'ext/rb_pgplot.c', line 1608

static VALUE
  rb_pgplot_pgswin(VALUE obj,VALUE arg0,VALUE arg1,VALUE arg2,VALUE arg3)
{
  
  cpgswin(NUM2DBL(arg0),NUM2DBL(arg1),NUM2DBL(arg2),NUM2DBL(arg3));
  return Qtrue;
}

.pgtbox(arg0, arg1, arg2, arg3, arg4, arg5) ⇒ Object



1280
1281
1282
1283
1284
1285
1286
# File 'ext/rb_pgplot.c', line 1280

static VALUE
  rb_pgplot_pgtbox(VALUE obj,VALUE arg0,VALUE arg1,VALUE arg2,VALUE arg3,VALUE arg4,VALUE arg5)
{
  
  cpgtbox(StringValuePtr(arg0),NUM2DBL(arg1),NUM2INT(arg2),StringValuePtr(arg3),NUM2DBL(arg4),NUM2INT(arg5));
  return Qtrue;
}

.pgtext(arg0, arg1, arg2) ⇒ Object



1400
1401
1402
1403
1404
1405
1406
# File 'ext/rb_pgplot.c', line 1400

static VALUE
  rb_pgplot_pgtext(VALUE obj,VALUE arg0,VALUE arg1,VALUE arg2)
{
  
  cpgtext(NUM2DBL(arg0),NUM2DBL(arg1),StringValuePtr(arg2));
  return Qtrue;
}

.pgtick(*args) ⇒ Object

PGTICK – draw a single tick mark on an axis

pgtick( x1, y1, x2, y2, v, [str], {"tickl", "tickr", "disp", "orient"})

Example:
pgtick( 0,0,0,1, 0.5, "half", "tickr"=>1, "disp"=>2, "orient"=>90 )

 Draw and label single tick mark on a graph axis. The tick mark is
 a short line perpendicular to the direction of the axis (which is not
 drawn by this routine). The optional text label is drawn with its
 baseline parallel to the axis and reading in the same direction as
 the axis (from point 1 to point 2). Current line and text attributes
 are used.

 Arguments:
  X1, Y1  : world coordinates of one endpoint of the axis.
  X2, Y2  : world coordinates of the other endpoint of the axis.
  V       : draw the tick mark at fraction V (0<=V<=1) along
	       the line from (X1,Y1) to (X2,Y2).
  STR     : text of label (may be blank).
 Keyword Arguments:
  TICKL   : length of tick mark drawn to left of axis
	       (as seen looking from first endpoint to second), in
	       units of the character height.
  TICKR   : length of major tick marks drawn to right of axis,
	       in units of the character height.
  DISP    : displacement of label text to
	       right of axis, in units of the character height.
  ORIENT  : orientation of label text, in degrees; angle between
	       baseline of text and direction of axis (0-360 deg)


1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
# File 'ext/rb_pgplot.c', line 1081

static VALUE
  rb_pgplot_pgtick( int argc, VALUE *argv, VALUE self )
{
  const char *str="";
  VALUE val=Qnil;
  VALUE x1, y1, x2, y2, v, vstr;
  VALUE tickl, tickr, disp, orient;

  if (argc>0 && TYPE(argv[argc-1]) == T_HASH)
    val = argv[--argc];
  rb_scan_kw_args( val, "tickl", &tickl, "tickr", &tickr,
		   "disp", &disp, "orient", &orient, (char *)0);
  rb_scan_args(argc,argv, "51", &x1,&y1, &x2,&y2, &v, &vstr);

  if (tickl ==Qnil)  tickl = INT2FIX(0);
  if (tickr ==Qnil)  tickr = INT2FIX(0);
  if (disp  ==Qnil)  disp  = INT2FIX(1);
  if (orient==Qnil)  orient= INT2FIX(0);
  if (vstr  !=Qnil)  str   = StringValuePtr(vstr);

  cpgtick( NUM2DBL(x1),NUM2DBL(y1),NUM2DBL(x2),NUM2DBL(y2),
	   NUM2DBL(v), NUM2DBL(tickl),NUM2DBL(tickr),
	   NUM2DBL(disp), NUM2DBL(orient), str );
  return Qnil;
}

.pgunsaObject



1448
1449
1450
1451
1452
1453
1454
# File 'ext/rb_pgplot.c', line 1448

static VALUE
  rb_pgplot_pgunsa(VALUE obj)
{
  
  cpgunsa();
  return Qtrue;
}

.pgupdtObject



1248
1249
1250
1251
1252
1253
1254
# File 'ext/rb_pgplot.c', line 1248

static VALUE
  rb_pgplot_pgupdt(VALUE obj)
{
  
  cpgupdt();
  return Qtrue;
}

.pgvect(*args) ⇒ Object

PGVECT – vector map of a 2D data array, with blanking

pgvect, x, y [, scale, pos, tr, blank ]

x     : horizontal component data array.
y     : vertical component data array.
scale : scale factor for vector lengths, if 0.0, C will be
        set so that the longest vector is equal to the
        smaller of TR(2)+TR(3) and TR(5)+TR(6).
pos   : vector positioning code.
        <0 vector head positioned on coordinates
        >0 vector base positioned on coordinates
        =0 vector centered on the coordinates
tr    : transformation matrix
blank : elements of arrays A or B that are exactly equal to
        this value are ignored (blanked).


556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
# File 'ext/rb_pgplot.c', line 556

static VALUE
  rb_pgplot_pgvect( int argc, VALUE *argv, VALUE self )
{
  VALUE vx,vy,vscl,vpos,vtr,vblank;
  VALUE na_x, na_y;
  int pos=0;
  float scale=0, blank=0, *tr;

  rb_scan_args(argc, argv, "24", &vx,&vy,&vscl,&vpos,&vtr,&vblank);

  /* Vector Data */
  na_x = rb_pgplot_fltary( vx );
  na_y = rb_pgplot_fltary( vy );
  if (NA_RANK(na_x) != 2 || NA_RANK(na_y) != 2 )
    rb_raise(rb_eArgError, "Vector arrays must be 2-D (N)Array");
  if (NA_SHAPE0(na_x) != NA_SHAPE0(na_y) || NA_SHAPE1(na_x) != NA_SHAPE1(na_y) )
    rb_raise(rb_eArgError, "Vector array sizes must be same");
  /* Options */
  if (vscl!=Qnil) scale = NUM2DBL(vscl);
  if (vpos!=Qnil) pos = NUM2INT(vpos);
  if (vblank!=Qnil) blank = NUM2DBL(vblank);
  /* Transform */
  tr = rb_pgplot_transform( vtr );
  /* Show Contour */
  cpgvect( NA_PTR_FLT(na_x), NA_PTR_FLT(na_y),
	   NA_SHAPE0(na_x), NA_SHAPE1(na_x),
	   1, NA_SHAPE0(na_x), 1, NA_SHAPE1(na_x),
	   scale, pos, tr, blank );
  return Qtrue;
}

.pgvsiz(arg0, arg1, arg2, arg3) ⇒ Object



1288
1289
1290
1291
1292
1293
1294
# File 'ext/rb_pgplot.c', line 1288

static VALUE
  rb_pgplot_pgvsiz(VALUE obj,VALUE arg0,VALUE arg1,VALUE arg2,VALUE arg3)
{
  
  cpgvsiz(NUM2DBL(arg0),NUM2DBL(arg1),NUM2DBL(arg2),NUM2DBL(arg3));
  return Qtrue;
}

.pgvstdObject



1296
1297
1298
1299
1300
1301
1302
# File 'ext/rb_pgplot.c', line 1296

static VALUE
  rb_pgplot_pgvstd(VALUE obj)
{
  
  cpgvstd();
  return Qtrue;
}

.pgwedg(arg0, arg1, arg2, arg3, arg4, arg5) ⇒ Object



1320
1321
1322
1323
1324
1325
1326
# File 'ext/rb_pgplot.c', line 1320

static VALUE
  rb_pgplot_pgwedg(VALUE obj,VALUE arg0,VALUE arg1,VALUE arg2,VALUE arg3,VALUE arg4,VALUE arg5)
{
  
  cpgwedg(StringValuePtr(arg0),NUM2DBL(arg1),NUM2DBL(arg2),NUM2DBL(arg3),NUM2DBL(arg4),StringValuePtr(arg5));
  return Qtrue;
}

.pgwnad(arg0, arg1, arg2, arg3) ⇒ Object



1304
1305
1306
1307
1308
1309
1310
# File 'ext/rb_pgplot.c', line 1304

static VALUE
  rb_pgplot_pgwnad(VALUE obj,VALUE arg0,VALUE arg1,VALUE arg2,VALUE arg3)
{
  
  cpgwnad(NUM2DBL(arg0),NUM2DBL(arg1),NUM2DBL(arg2),NUM2DBL(arg3));
  return Qtrue;
}