Module: PLplot

Defined in:
ext/rbplplot.c

Defined Under Namespace

Modules: PL, PLK Classes: GraphicsIn

Class Method Summary collapse

Class Method Details

.pl_setcontlabelformat(lexp, sigdig) ⇒ nil

Set format of numerical label for contours

Returns:

  • (nil)


2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
# File 'ext/rbplplot.c', line 2211

static VALUE
rb_mPLplot_pl_setcontlabelformat(VALUE obj,VALUE arg0,VALUE arg1)
{
  PLINT ivar0;
  PLINT ivar1;
  ivar0 = NUM2LONG(arg0);
  ivar1 = NUM2LONG(arg1);
  pl_setcontlabelformat(ivar0,ivar1);
  return Qnil;
}

.pl_setcontlabelparam(offset, size, spacing, active) ⇒ nil

Set parameters of contour labelling other than format of numerical label

Returns:

  • (nil)


2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
# File 'ext/rbplplot.c', line 2228

static VALUE
rb_mPLplot_pl_setcontlabelparam(VALUE obj,VALUE arg0,VALUE arg1,VALUE arg2,VALUE arg3)
{
  PLFLT ivar0;
  PLFLT ivar1;
  PLFLT ivar2;
  int ivar3;
  ivar0 = NUM2DBL(arg0);
  ivar1 = NUM2DBL(arg1);
  ivar2 = NUM2DBL(arg2);
  ivar3 = PL_RTEST(arg3);
  pl_setcontlabelparam(ivar0,ivar1,ivar2,ivar3);
  return Qnil;
}

.pladv(sub) ⇒ nil

Advance the (sub-)page

Returns:

  • (nil)


2249
2250
2251
2252
2253
2254
2255
2256
# File 'ext/rbplplot.c', line 2249

static VALUE
rb_mPLplot_pladv(VALUE obj,VALUE arg0)
{
  PLINT ivar0;
  ivar0 = NUM2LONG(arg0);
  pladv(ivar0);
  return Qnil;
}

.plarc(x, y, a, b, start_deg, end_deg, fill) ⇒ nil

Plot an arc.

Returns:

  • (nil)


2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
# File 'ext/rbplplot.c', line 2264

static VALUE
rb_mPLplot_plarc(VALUE obj,VALUE arg0,VALUE arg1,VALUE arg2,VALUE arg3,VALUE arg4,VALUE arg5,VALUE arg6)
{
  PLFLT ivar0;
  PLFLT ivar1;
  PLFLT ivar2;
  PLFLT ivar3;
  PLFLT ivar4;
  PLFLT ivar5;
  int ivar6;
  ivar0 = NUM2DBL(arg0);
  ivar1 = NUM2DBL(arg1);
  ivar2 = NUM2DBL(arg2);
  ivar3 = NUM2DBL(arg3);
  ivar4 = NUM2DBL(arg4);
  ivar5 = NUM2DBL(arg5);
  ivar6 = PL_RTEST(arg6);
  PLSYNC(plarc,ivar0,ivar1,ivar2,ivar3,ivar4,ivar5,ivar6);
  return Qnil;
}

.plaxes(x0, y0, xopt, xtick, nxsub, yopt, ytick, nysub) ⇒ nil

Draw a box with axes, etc. with arbitrary origin

Returns:

  • (nil)


2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
# File 'ext/rbplplot.c', line 2291

static VALUE
rb_mPLplot_plaxes(VALUE obj,VALUE arg0,VALUE arg1,VALUE arg2,VALUE arg3,VALUE arg4,VALUE arg5,VALUE arg6,VALUE arg7)
{
  PLFLT ivar0;
  PLFLT ivar1;
  char * ivar2;
  PLFLT ivar3;
  PLINT ivar4;
  char * ivar5;
  PLFLT ivar6;
  PLINT ivar7;
  ivar0 = NUM2DBL(arg0);
  ivar1 = NUM2DBL(arg1);
  arg2 = rb_obj_as_string(arg2); ivar2 = StringValuePtr(arg2);
  ivar3 = NUM2DBL(arg3);
  ivar4 = NUM2LONG(arg4);
  arg5 = rb_obj_as_string(arg5); ivar5 = StringValuePtr(arg5);
  ivar6 = NUM2DBL(arg6);
  ivar7 = NUM2LONG(arg7);
  PLSYNC(plaxes,ivar0,ivar1,ivar2,ivar3,ivar4,ivar5,ivar6,ivar7);
  return Qnil;
}

.plbin(x, y, opt = PL::BIN_DEFAULT) ⇒ nil

Plot a histogram from binned data

Returns:

  • (nil)


445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
# File 'ext/rbplplot.c', line 445

static VALUE
rb_plplot_plbin(int argc, VALUE *argv, VALUE mod)
{
  VALUE vx, vy, vopt;
  PLFLT x1, y1;
  PLFLT *px, *py;
  int opt = PL_BIN_DEFAULT;
  int size;

  rb_scan_args(argc, argv, "21", &vx, &vy, &vopt);

  /* Allow a bin plot of a single point if x and y are scalars*/
  if(rb_obj_is_kind_of(vx, rb_cNumeric)) {
    x1 = NUM2DBL(vx); px = &x1;
    y1 = NUM2DBL(vy); py = &y1;
    size = 1;
  } else {
    vx = rb_plplot_fltary(vx); px = NA_PTR_PLFLT(vx);
    vy = rb_plplot_fltary(vy); py = NA_PTR_PLFLT(vy);
    size = min(NA_TOTAL(vx), NA_TOTAL(vy));
  }

  /*
   * Could be an if statement, but use switch to be consistent with other
   * functions.
   */
  switch(argc) {
    case 3: opt = NUM2INT(vopt);
  }

  PLSYNC(plbin, size, px, py, opt);

  return Qnil;
}

.plbopnil

Begin a new page

Returns:

  • (nil)


2320
2321
2322
2323
2324
2325
2326
2327
# File 'ext/rbplplot.c', line 2320

static VALUE
rb_mPLplot_plbop(VALUE obj)
{
  
  
  plbop();
  return Qnil;
}

.plbox(xopt, xtick, nxsub, yopt, ytick, nysub) ⇒ nil

Draw a box with axes, etc

Returns:

  • (nil)


2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
# File 'ext/rbplplot.c', line 2335

static VALUE
rb_mPLplot_plbox(VALUE obj,VALUE arg0,VALUE arg1,VALUE arg2,VALUE arg3,VALUE arg4,VALUE arg5)
{
  char * ivar0;
  PLFLT ivar1;
  PLINT ivar2;
  char * ivar3;
  PLFLT ivar4;
  PLINT ivar5;
  arg0 = rb_obj_as_string(arg0); ivar0 = StringValuePtr(arg0);
  ivar1 = NUM2DBL(arg1);
  ivar2 = NUM2LONG(arg2);
  arg3 = rb_obj_as_string(arg3); ivar3 = StringValuePtr(arg3);
  ivar4 = NUM2DBL(arg4);
  ivar5 = NUM2LONG(arg5);
  PLSYNC(plbox,ivar0,ivar1,ivar2,ivar3,ivar4,ivar5);
  return Qnil;
}

.plbox3(xopt, xlabel, xtick, nxsub, yopt, ylabel, ytick, nysub, zopt, zlabel, ztick, nzsub) ⇒ nil

Draw a box with axes, etc, in 3-d

Returns:

  • (nil)


2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
# File 'ext/rbplplot.c', line 2360

static VALUE
rb_mPLplot_plbox3(VALUE obj,VALUE arg0,VALUE arg1,VALUE arg2,VALUE arg3,VALUE arg4,VALUE arg5,VALUE arg6,VALUE arg7,VALUE arg8,VALUE arg9,VALUE arg10,VALUE arg11)
{
  char * ivar0;
  char * ivar1;
  PLFLT ivar2;
  PLINT ivar3;
  char * ivar4;
  char * ivar5;
  PLFLT ivar6;
  PLINT ivar7;
  char * ivar8;
  char * ivar9;
  PLFLT ivar10;
  PLINT ivar11;
  arg0 = rb_obj_as_string(arg0); ivar0 = StringValuePtr(arg0);
  arg1 = rb_obj_as_string(arg1); ivar1 = StringValuePtr(arg1);
  ivar2 = NUM2DBL(arg2);
  ivar3 = NUM2LONG(arg3);
  arg4 = rb_obj_as_string(arg4); ivar4 = StringValuePtr(arg4);
  arg5 = rb_obj_as_string(arg5); ivar5 = StringValuePtr(arg5);
  ivar6 = NUM2DBL(arg6);
  ivar7 = NUM2LONG(arg7);
  arg8 = rb_obj_as_string(arg8); ivar8 = StringValuePtr(arg8);
  arg9 = rb_obj_as_string(arg9); ivar9 = StringValuePtr(arg9);
  ivar10 = NUM2DBL(arg10);
  ivar11 = NUM2LONG(arg11);
  PLSYNC(plbox3,ivar0,ivar1,ivar2,ivar3,ivar4,ivar5,ivar6,ivar7,ivar8,ivar9,ivar10,ivar11);
  return Qnil;
}

.plcalc_world(rx, ry) ⇒ Array

Calculate world coordinates and corresponding window index from relative device coordinates

Returns:

  • (Array)


2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
# File 'ext/rbplplot.c', line 2397

static VALUE
rb_mPLplot_plcalc_world(VALUE obj,VALUE arg0,VALUE arg1)
{
  PLFLT ivar0;
  PLFLT ivar1;
  PLFLT ovar0;
  PLFLT ovar1;
  PLINT ovar2;
  ivar0 = NUM2DBL(arg0);
  ivar1 = NUM2DBL(arg1);
  plcalc_world(ivar0,ivar1,&ovar0,&ovar1,&ovar2);
  return rb_ary_new3(3,
    rb_float_new(ovar0),
    rb_float_new(ovar1),
    LONG2NUM(ovar2)
  );
}

.plclearnil

Clear current (sub)page

Returns:

  • (nil)


2421
2422
2423
2424
2425
2426
2427
2428
# File 'ext/rbplplot.c', line 2421

static VALUE
rb_mPLplot_plclear(VALUE obj)
{
  
  
  PLSYNC(plclear,);
  return Qnil;
}

.plcol0(color) ⇒ nil

Set color, map0

Returns:

  • (nil)


2436
2437
2438
2439
2440
2441
2442
2443
# File 'ext/rbplplot.c', line 2436

static VALUE
rb_mPLplot_plcol0(VALUE obj,VALUE arg0)
{
  PLINT ivar0;
  ivar0 = NUM2LONG(arg0);
  plcol0(ivar0);
  return Qnil;
}

.plcol1(col1) ⇒ nil

Set color, map1

Returns:

  • (nil)


2451
2452
2453
2454
2455
2456
2457
2458
# File 'ext/rbplplot.c', line 2451

static VALUE
rb_mPLplot_plcol1(VALUE obj,VALUE arg0)
{
  PLFLT ivar0;
  ivar0 = NUM2DBL(arg0);
  plcol1(ivar0);
  return Qnil;
}

.plcont(z, xi_range, yj_range, clevel) ⇒ nil .plcont(z, xi_range, yj_range, clevel) {|x, y| ... } ⇒ nil .plcont(z, xi_range, yj_range, clevel, x, y) ⇒ nil

Contour plot

First form (four arguments without a block) uses PLplot’s pltr0 identity transform.

Second form (four arguments with a block) uses the provided block to perform the coordinate transform.

Third form (six arguments) uses PLplot’s pltr1 transform if x and y are one dimensional or PLplot’s pltr2p transform if x or y are two dimensional.

NB: xi_range and yj_range are ZERO based to follow Ruby conventions even though they are one based in PLplot’s plcont functions. As in Ruby, negative values count back from the end of the corresponding z dimension.

Overloads:

  • .plcont(z, xi_range, yj_range, clevel) ⇒ nil

    Returns:

    • (nil)
  • .plcont(z, xi_range, yj_range, clevel) {|x, y| ... } ⇒ nil

    Yields:

    • (x, y)

    Returns:

    • (nil)
  • .plcont(z, xi_range, yj_range, clevel, x, y) ⇒ nil

    Returns:

    • (nil)


592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
# File 'ext/rbplplot.c', line 592

static VALUE
rb_plplot_plcont(int argc, VALUE *argv, VALUE mod)
{
  VALUE vz, vxrange, vyrange, vc, vtr0=Qnil, vtr1=Qnil;
  PLINT nx, ny, kx, lx, ky, ly;
  PLFLT * pc;
  PLINT nc;
  void (*pltr)(PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer);
  PLfGrid gz;
  PLcGrid gt;

  rb_scan_args(argc, argv, "42", &vz, &vxrange, &vyrange, &vc, &vtr0, &vtr1);

  vz = rb_plplot_fltary(vz); gz.f = NA_PTR_PLFLT(vz);
  if(NA_RANK(vz) != 2)
    rb_raise(rb_eArgError, "z must be two dimensional");
  nx = gt.nx = gz.nx = NA_SHAPE1(vz);
  ny = gt.ny = gz.ny = NA_SHAPE0(vz);
  rb_get_int_pair(vxrange, &kx, &lx, 0, nx-1);
  rb_get_int_pair(vyrange, &ky, &ly, 0, ny-1);
  if(kx < 0) kx += nx; if(lx < 0) lx += nx;
  if(ky < 0) ky += ny; if(ly < 0) ly += ny;

  /*
   * Bounds check kx, lx, ky, ly so that plcont won't report confusing message
   * with one-based values.
   */
  if(kx < 0 || nx <= kx)
    rb_raise(rb_eIndexError, "lower x index %d out of range [0,%d]", kx, nx-1);
  if(lx < 0 || nx <= lx)
    rb_raise(rb_eIndexError, "upper x index %d out of range [0,%d]", lx, nx-1);
  if(lx < kx)
    rb_raise(rb_eIndexError, "upper x index %d less than lower x index %d", lx, kx);
  if(ky < 0 || ny <= ky)
    rb_raise(rb_eIndexError, "lower y index %d out of range [0,%d]", ky, ny-1);
  if(lx < 0 || ny <= lx)
    rb_raise(rb_eIndexError, "upper y index %d out of range [0,%d]", lx, ny-1);
  if(ly < ky)
    rb_raise(rb_eIndexError, "upper y index %d less than lower y index %d", ly, ky);

  /* Add 1 to convert to one-based indexing */
  kx++; lx++; ky++; ly++;

  vc = rb_plplot_fltary(vc); pc = NA_PTR_PLFLT(vc); nc = NA_TOTAL(vc);

  /* Warn if unnecessary block is given */
  if(argc > 4 && rb_block_given_p())
    rb_warning("unnecessary block given");

  /* Setup pltr parameters */
  rb_setup_pltr(vtr0, vtr1, &gt, &pltr);

  PLSYNC(plfcont, plf2eval, &gz, nx, ny, kx, lx, ky, ly, pc, nc, pltr, &gt);

  return Qnil;
}

.plcpstrm(iplsr, flags) ⇒ nil

Copy state parameters from the reference stream to the current stream

Returns:

  • (nil)


2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
# File 'ext/rbplplot.c', line 2466

static VALUE
rb_mPLplot_plcpstrm(VALUE obj,VALUE arg0,VALUE arg1)
{
  PLINT ivar0;
  int ivar1;
  ivar0 = NUM2LONG(arg0);
  ivar1 = PL_RTEST(arg1);
  plcpstrm(ivar0,ivar1);
  return Qnil;
}

.pldebugObject

For debug/diagnostic use only!



2195
2196
2197
2198
2199
2200
# File 'ext/rbplplot.c', line 2195

static VALUE
rb_plplot_mydebug(VALUE mod)
{
  /* Put debug stuff here */
  return Qnil;
}

.pldefinednil, ... .pldefined(a_Proc) ⇒ nil .pldefined(x_range, y_range) ⇒ nil .pldefined {|x, y| ... } ⇒ nil

Returns or sets the Proc object or Range objects used by plshade to determine whether a point is defined. Calling with no arguments and no block will return the current Proc or pair of Range objects used. Either the Proc object or the pair of Range objects are used; using both is not permitted. Setting Proc to nil will include all points.

Overloads:

  • .pldefinednil, ...

    Returns:

    • (nil, Proc, Array)
  • .pldefined(a_Proc) ⇒ nil

    Returns:

    • (nil)
  • .pldefined(x_range, y_range) ⇒ nil

    Returns:

    • (nil)
  • .pldefined {|x, y| ... } ⇒ nil

    Yields:

    • (x, y)

    Returns:

    • (nil)


254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
# File 'ext/rbplplot.c', line 254

static VALUE
rb_plplot_pldefined(int argc, VALUE *argv, VALUE mod)
{
  VALUE v0, v1;

  rb_scan_args(argc, argv, "02", &v0, &v1);

  if(argc == 0) {
    if(rb_block_given_p()) {
      /* defined {|x,y| ...} -> nil */
      rb_plplot_pldefined_proc = rb_block_proc();
    } else if(!NIL_P(rb_plplot_pldefined_proc)) {
      /* defined -> Proc */
      return rb_plplot_pldefined_proc;
    } else if(!NIL_P(rb_plplot_pldefined_xrange) && !NIL_P(rb_plplot_pldefined_yrange)) {
      /* defined -> [x_range, y_range] */
      return rb_ary_new3(2, rb_plplot_pldefined_xrange, rb_plplot_pldefined_yrange);
    } /* else return Qnil below */
  } else {
    if(rb_block_given_p())
      rb_warning("unnecessary block given");
    if(argc == 1) {
      if(NIL_P(v0)) {
        /* defined(nil) -> nil */
        rb_plplot_pldefined_proc = Qnil;
        rb_plplot_pldefined_xrange = Qnil;
        rb_plplot_pldefined_yrange = Qnil;
      } else if(rb_obj_is_kind_of(v0, rb_cProc)) {
        /* defined(a_Proc) -> nil */
        rb_plplot_pldefined_proc = v0;
        rb_plplot_pldefined_xrange = Qnil;
        rb_plplot_pldefined_yrange = Qnil;
      } else {
        rb_raise(rb_eTypeError,
            "wrong argument type %s (expected nil or Proc)",
            rb_obj_classname(v0));
      }
    } else { /* argc == 2 */
      if(!NIL_P(v0) && !rb_obj_is_kind_of(v0, rb_cRange)) {
        rb_raise(rb_eTypeError,
            "wrong argument type %s for x_range (expected nil or Range)",
            rb_obj_classname(v0));
      }
      if(!NIL_P(v1) && !rb_obj_is_kind_of(v1, rb_cRange)) {
        rb_raise(rb_eTypeError,
            "wrong argument type %s for y_range (expected nil or Range)",
            rb_obj_classname(v1));
      }
      rb_plplot_pldefined_proc = Qnil;
      rb_plplot_pldefined_xrange = v0;
      rb_plplot_pldefined_yrange = v1;
      if(!NIL_P(v0)) {
        rb_plplot_pldefined_xrange_min = NUM2DBL(rb_funcall(v0, id_beg, 0));
        rb_plplot_pldefined_xrange_max = NUM2DBL(rb_funcall(v0, id_end, 0));
        rb_plplot_pldefined_xrange_exc = RTEST(rb_funcall(v0, id_exclude_end_p, 0));
      }
      if(!NIL_P(v1)) {
        rb_plplot_pldefined_yrange_min = NUM2DBL(rb_funcall(v1, id_beg, 0));
        rb_plplot_pldefined_yrange_max = NUM2DBL(rb_funcall(v1, id_end, 0));
        rb_plplot_pldefined_yrange_exc = RTEST(rb_funcall(v1, id_exclude_end_p, 0));
      }
    }
  }

  return Qnil;
}

.pldid2pc(dxmin, dymin, dxmax, dymax) ⇒ Array

Converts input values from relative device coordinates to relative plot coordinates.

Returns:

  • (Array)


658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
# File 'ext/rbplplot.c', line 658

static VALUE
rb_plplot_pldid2pc(VALUE mod, VALUE vxmin, VALUE vymin, VALUE vxmax, VALUE vymax)
{
  PLFLT xmin, ymin, xmax, ymax;

  xmin = NUM2DBL(xmin);
  ymin = NUM2DBL(ymin);
  xmax = NUM2DBL(xmax);
  ymax = NUM2DBL(ymax);

  pldid2pc(&xmin, &ymin, &xmax, &ymax);

  return rb_ary_new3(4,
      rb_float_new(xmin),
      rb_float_new(ymin),
      rb_float_new(xmax),
      rb_float_new(ymax));
}

.dldid2dc(dxmin, dymin, dxmax, dymax) ⇒ Array

Converts input values from relative plot coordinates to relative device coordinates.

Returns:

  • (Array)


684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
# File 'ext/rbplplot.c', line 684

static VALUE
rb_plplot_pldip2dc(VALUE mod, VALUE vxmin, VALUE vymin, VALUE vxmax, VALUE vymax)
{
  PLFLT xmin, ymin, xmax, ymax;

  xmin = NUM2DBL(xmin);
  ymin = NUM2DBL(ymin);
  xmax = NUM2DBL(xmax);
  ymax = NUM2DBL(ymax);

  pldip2dc(&xmin, &ymin, &xmax, &ymax);

  return rb_ary_new3(4,
      rb_float_new(xmin),
      rb_float_new(ymin),
      rb_float_new(xmax),
      rb_float_new(ymax));
}

.plendnil

End plotting session

Returns:

  • (nil)


2483
2484
2485
2486
2487
2488
2489
2490
# File 'ext/rbplplot.c', line 2483

static VALUE
rb_mPLplot_plend(VALUE obj)
{
  
  
  plend();
  return Qnil;
}

.plend!Qnil

Sets “no pause” mode and then calls plend. This will not wait for the user to dismiss the final plot on interactive displays.

Returns:

  • (Qnil)


710
711
712
713
714
715
716
# File 'ext/rbplplot.c', line 710

static VALUE
rb_plplot_plend_bang(VALUE mod)
{
  plspause(0);
  plend();
  return Qnil;
}

.plend1nil

End plotting session for current stream

Returns:

  • (nil)


2498
2499
2500
2501
2502
2503
2504
2505
# File 'ext/rbplplot.c', line 2498

static VALUE
rb_mPLplot_plend1(VALUE obj)
{
  
  
  plend1();
  return Qnil;
}

.plenv(xmin, xmax, ymin, ymax, just, axis) ⇒ nil

Set up standard window and draw box

Returns:

  • (nil)


2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
# File 'ext/rbplplot.c', line 2513

static VALUE
rb_mPLplot_plenv(VALUE obj,VALUE arg0,VALUE arg1,VALUE arg2,VALUE arg3,VALUE arg4,VALUE arg5)
{
  PLFLT ivar0;
  PLFLT ivar1;
  PLFLT ivar2;
  PLFLT ivar3;
  PLINT ivar4;
  PLINT ivar5;
  ivar0 = NUM2DBL(arg0);
  ivar1 = NUM2DBL(arg1);
  ivar2 = NUM2DBL(arg2);
  ivar3 = NUM2DBL(arg3);
  ivar4 = NUM2LONG(arg4);
  ivar5 = NUM2LONG(arg5);
  PLSYNC(plenv,ivar0,ivar1,ivar2,ivar3,ivar4,ivar5);
  return Qnil;
}

.plenv0(xmin, xmax, ymin, ymax, just, axis) ⇒ nil

Same as plenv but if in multiplot mode does not advance the subpage, instead clears it.

Returns:

  • (nil)


2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
# File 'ext/rbplplot.c', line 2538

static VALUE
rb_mPLplot_plenv0(VALUE obj,VALUE arg0,VALUE arg1,VALUE arg2,VALUE arg3,VALUE arg4,VALUE arg5)
{
  PLFLT ivar0;
  PLFLT ivar1;
  PLFLT ivar2;
  PLFLT ivar3;
  PLINT ivar4;
  PLINT ivar5;
  ivar0 = NUM2DBL(arg0);
  ivar1 = NUM2DBL(arg1);
  ivar2 = NUM2DBL(arg2);
  ivar3 = NUM2DBL(arg3);
  ivar4 = NUM2LONG(arg4);
  ivar5 = NUM2LONG(arg5);
  PLSYNC(plenv0,ivar0,ivar1,ivar2,ivar3,ivar4,ivar5);
  return Qnil;
}

.pleopnil

Eject current page

Returns:

  • (nil)


2563
2564
2565
2566
2567
2568
2569
2570
# File 'ext/rbplplot.c', line 2563

static VALUE
rb_mPLplot_pleop(VALUE obj)
{
  
  
  pleop();
  return Qnil;
}

.plerrx(xmin, xmax, y) ⇒ nil

Draw x error bars

Returns:

  • (nil)


751
752
753
754
755
756
# File 'ext/rbplplot.c', line 751

static VALUE
rb_plplot_plerrx(VALUE mod, VALUE xmin, VALUE xmax, VALUE y)
{
  plplot_errorbar('x', xmin, xmax, y);
  return Qnil;
}

.plerry(x, ymin, ymax) ⇒ nil

Draw y error bars

Returns:

  • (nil)


763
764
765
766
767
768
# File 'ext/rbplplot.c', line 763

static VALUE
rb_plplot_plerry(VALUE mod, VALUE x, VALUE ymin, VALUE ymax)
{
  plplot_errorbar('y', x, ymin, ymax);
  return Qnil;
}

.plfamadvnil

Advance to the next family file on the next new page

Returns:

  • (nil)


2578
2579
2580
2581
2582
2583
2584
2585
# File 'ext/rbplplot.c', line 2578

static VALUE
rb_mPLplot_plfamadv(VALUE obj)
{
  
  
  plfamadv();
  return Qnil;
}

.plfill(x, y) ⇒ nil

Draw filled polygon

Returns:

  • (nil)


776
777
778
779
780
781
782
783
784
785
786
787
788
789
# File 'ext/rbplplot.c', line 776

static VALUE
rb_plplot_plfill(VALUE vmod, VALUE vx, VALUE vy)
{
  PLFLT *px, *py;
  int size;

  vx = rb_plplot_fltary(vx); px = NA_PTR_PLFLT(vx);
  vy = rb_plplot_fltary(vy); py = NA_PTR_PLFLT(vy);
  size = min(NA_TOTAL(vx), NA_TOTAL(vy));

  PLSYNC(plfill, size, px, py);

  return Qnil;
}

.plfill3(x, y, z) ⇒ nil

Draw filled polygon in 3D

Returns:

  • (nil)


797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
# File 'ext/rbplplot.c', line 797

static VALUE
rb_plplot_plfill3(VALUE vmod, VALUE vx, VALUE vy, VALUE vz)
{
  PLFLT *px, *py, *pz;
  int size;

  vx = rb_plplot_fltary(vx); px = NA_PTR_PLFLT(vx);
  vy = rb_plplot_fltary(vy); py = NA_PTR_PLFLT(vy);
  vz = rb_plplot_fltary(vz); pz = NA_PTR_PLFLT(vz);
  size = min(NA_TOTAL(vx), NA_TOTAL(vy));
  size = min(size,NA_TOTAL(vz));

  PLSYNC(plfill3, size, px, py, pz);

  return Qnil;
}

.plflushnil

Flushes the output stream

Returns:

  • (nil)


2593
2594
2595
2596
2597
2598
2599
2600
# File 'ext/rbplplot.c', line 2593

static VALUE
rb_mPLplot_plflush(VALUE obj)
{
  
  
  plflush();
  return Qnil;
}

.plfont(font) ⇒ nil

Set character font

Returns:

  • (nil)


2608
2609
2610
2611
2612
2613
2614
2615
# File 'ext/rbplplot.c', line 2608

static VALUE
rb_mPLplot_plfont(VALUE obj,VALUE arg0)
{
  PLINT ivar0;
  ivar0 = NUM2LONG(arg0);
  plfont(ivar0);
  return Qnil;
}

.plfontld(set) ⇒ nil

Load character font

Returns:

  • (nil)


2623
2624
2625
2626
2627
2628
2629
2630
# File 'ext/rbplplot.c', line 2623

static VALUE
rb_mPLplot_plfontld(VALUE obj,VALUE arg0)
{
  PLINT ivar0;
  ivar0 = NUM2LONG(arg0);
  plfontld(ivar0);
  return Qnil;
}

.plgchrArray

Get character default height and current (scaled) height

Returns:

  • (Array)


2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
# File 'ext/rbplplot.c', line 2638

static VALUE
rb_mPLplot_plgchr(VALUE obj)
{
  PLFLT ovar0;
  PLFLT ovar1;
  
  plgchr(&ovar0,&ovar1);
  return rb_ary_new3(2,
    rb_float_new(ovar0),
    rb_float_new(ovar1)
  );
}

.plgcol0(icol0) ⇒ Array

Returns Fixnum (0-255) RGB values for given color from color map0

Returns:

  • (Array)


2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
# File 'ext/rbplplot.c', line 2657

static VALUE
rb_mPLplot_plgcol0(VALUE obj,VALUE arg0)
{
  PLINT ivar0;
  PLINT ovar0;
  PLINT ovar1;
  PLINT ovar2;
  ivar0 = NUM2LONG(arg0);
  plgcol0(ivar0,&ovar0,&ovar1,&ovar2);
  return rb_ary_new3(3,
    LONG2NUM(ovar0),
    LONG2NUM(ovar1),
    LONG2NUM(ovar2)
  );
}

.plgcol0a(icol0) ⇒ Array

Returns Fixnum (0-255) RGB values and Float alpha value for given color from color map0.

Returns:

  • (Array)


2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
# File 'ext/rbplplot.c', line 2679

static VALUE
rb_mPLplot_plgcol0a(VALUE obj,VALUE arg0)
{
  PLINT ivar0;
  PLINT ovar0;
  PLINT ovar1;
  PLINT ovar2;
  PLFLT ovar3;
  ivar0 = NUM2LONG(arg0);
  plgcol0a(ivar0,&ovar0,&ovar1,&ovar2,&ovar3);
  return rb_ary_new3(4,
    LONG2NUM(ovar0),
    LONG2NUM(ovar1),
    LONG2NUM(ovar2),
    rb_float_new(ovar3)
  );
}

.plgcolbgArray

Returns the background color (cmap0) by Fixnum (0-255) RGB value

Returns:

  • (Array)


2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
# File 'ext/rbplplot.c', line 2703

static VALUE
rb_mPLplot_plgcolbg(VALUE obj)
{
  PLINT ovar0;
  PLINT ovar1;
  PLINT ovar2;
  
  plgcolbg(&ovar0,&ovar1,&ovar2);
  return rb_ary_new3(3,
    LONG2NUM(ovar0),
    LONG2NUM(ovar1),
    LONG2NUM(ovar2)
  );
}

.plgcolbgaArray

Returns the background color (cmap0) by Fixnum (0-255) RGB value and Float alpha value.

Returns:

  • (Array)


2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
# File 'ext/rbplplot.c', line 2724

static VALUE
rb_mPLplot_plgcolbga(VALUE obj)
{
  PLINT ovar0;
  PLINT ovar1;
  PLINT ovar2;
  PLFLT ovar3;
  
  plgcolbga(&ovar0,&ovar1,&ovar2,&ovar3);
  return rb_ary_new3(4,
    LONG2NUM(ovar0),
    LONG2NUM(ovar1),
    LONG2NUM(ovar2),
    rb_float_new(ovar3)
  );
}

.plgcompressionObject

Get the current device-compression setting



2747
2748
2749
2750
2751
2752
2753
2754
# File 'ext/rbplplot.c', line 2747

static VALUE
rb_mPLplot_plgcompression(VALUE obj)
{
  PLINT ovar0;
  
  plgcompression(&ovar0);
  return LONG2NUM(ovar0);
}

.plgdevObject

Get the current device (keyword) name



2762
2763
2764
2765
2766
2767
2768
2769
# File 'ext/rbplplot.c', line 2762

static VALUE
rb_mPLplot_plgdev(VALUE obj)
{
  char ovar0[100] = {'\0'};
  
  plgdev(ovar0);
  return rb_str_new2(ovar0);
}

.plgdidevArray

Get parameters that define current device-space window

Returns:

  • (Array)


2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
# File 'ext/rbplplot.c', line 2777

static VALUE
rb_mPLplot_plgdidev(VALUE obj)
{
  PLFLT ovar0;
  PLFLT ovar1;
  PLFLT ovar2;
  PLFLT ovar3;
  
  plgdidev(&ovar0,&ovar1,&ovar2,&ovar3);
  return rb_ary_new3(4,
    rb_float_new(ovar0),
    rb_float_new(ovar1),
    rb_float_new(ovar2),
    rb_float_new(ovar3)
  );
}

.plgdioriObject

Get plot orientation



2800
2801
2802
2803
2804
2805
2806
2807
# File 'ext/rbplplot.c', line 2800

static VALUE
rb_mPLplot_plgdiori(VALUE obj)
{
  PLFLT ovar0;
  
  plgdiori(&ovar0);
  return rb_float_new(ovar0);
}

.plgdipltArray

Get parameters that define current plot-space window

Returns:

  • (Array)


2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
# File 'ext/rbplplot.c', line 2815

static VALUE
rb_mPLplot_plgdiplt(VALUE obj)
{
  PLFLT ovar0;
  PLFLT ovar1;
  PLFLT ovar2;
  PLFLT ovar3;
  
  plgdiplt(&ovar0,&ovar1,&ovar2,&ovar3);
  return rb_ary_new3(4,
    rb_float_new(ovar0),
    rb_float_new(ovar1),
    rb_float_new(ovar2),
    rb_float_new(ovar3)
  );
}

.plgescObject



2838
2839
2840
2841
2842
2843
2844
2845
# File 'ext/rbplplot.c', line 2838

static VALUE
rb_mPLplot_plgesc(VALUE obj)
{
  char ovar0[100] = {'\0'};
  
  plgesc(ovar0);
  return rb_str_new2(ovar0);
}

.plGetCursorPLGraphicsIn

Wait for graphics input event and translate to world coordinates.

Returns a PLGraphicsIn object (or nil if no translation to world coordinates is possible).

Returns:

  • (PLGraphicsIn)


2163
2164
2165
2166
2167
2168
2169
2170
2171
# File 'ext/rbplplot.c', line 2163

static VALUE
rb_plplot_plGetCursor(VALUE mod)
{
  int ok;
  PLGraphicsIn *p;
  VALUE v = Data_Make_Struct(cPLGraphicsIn, PLGraphicsIn, NULL, NULL, p);
  ok = plGetCursor(p);
  return ok ? v : Qnil;
}

.plgfamArray, Numeric

Get family file parameters

Returns:

  • (Array, Numeric)


2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
# File 'ext/rbplplot.c', line 2853

static VALUE
rb_mPLplot_plgfam(VALUE obj)
{
  int ovar0;
  PLINT ovar1;
  PLINT ovar2;
  
  plgfam(&ovar0,&ovar1,&ovar2);
  return rb_ary_new3(3,
    (ovar0 ? Qtrue : Qfalse),
    LONG2NUM(ovar1),
    LONG2NUM(ovar2)
  );
}

.plgfciObject

Get FCI (font characterization integer)



2874
2875
2876
2877
2878
2879
2880
2881
# File 'ext/rbplplot.c', line 2874

static VALUE
rb_mPLplot_plgfci(VALUE obj)
{
  PLUNICODE ovar0;
  
  plgfci(&ovar0);
  return UINT2NUM(ovar0);
}

.plgfnamObject

Get output file name



2889
2890
2891
2892
2893
2894
2895
2896
# File 'ext/rbplplot.c', line 2889

static VALUE
rb_mPLplot_plgfnam(VALUE obj)
{
  char ovar0[100] = {'\0'};
  
  plgfnam(ovar0);
  return rb_str_new2(ovar0);
}

.plgfontArray

Get family, style and weight of the current font

Returns:

  • (Array)


2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
# File 'ext/rbplplot.c', line 2904

static VALUE
rb_mPLplot_plgfont(VALUE obj)
{
  PLINT ovar0;
  PLINT ovar1;
  PLINT ovar2;
  
  plgfont(&ovar0,&ovar1,&ovar2);
  return rb_ary_new3(3,
    LONG2NUM(ovar0),
    LONG2NUM(ovar1),
    LONG2NUM(ovar2)
  );
}

.plglevelObject

Get the (current) run level



2925
2926
2927
2928
2929
2930
2931
2932
# File 'ext/rbplplot.c', line 2925

static VALUE
rb_mPLplot_plglevel(VALUE obj)
{
  PLINT ovar0;
  
  plglevel(&ovar0);
  return LONG2NUM(ovar0);
}

.plgpageArray

Get page parameters

Returns:

  • (Array)


2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
# File 'ext/rbplplot.c', line 2940

static VALUE
rb_mPLplot_plgpage(VALUE obj)
{
  PLFLT ovar0;
  PLFLT ovar1;
  PLINT ovar2;
  PLINT ovar3;
  PLINT ovar4;
  PLINT ovar5;
  
  plgpage(&ovar0,&ovar1,&ovar2,&ovar3,&ovar4,&ovar5);
  return rb_ary_new3(6,
    rb_float_new(ovar0),
    rb_float_new(ovar1),
    LONG2NUM(ovar2),
    LONG2NUM(ovar3),
    LONG2NUM(ovar4),
    LONG2NUM(ovar5)
  );
}

.plgranil

Switch to graphics screen

Returns:

  • (nil)


2967
2968
2969
2970
2971
2972
2973
2974
# File 'ext/rbplplot.c', line 2967

static VALUE
rb_mPLplot_plgra(VALUE obj)
{
  
  
  PLSYNC(plgra,);
  return Qnil;
}

.plgradient(x, y, degrees) ⇒ nil

Draw gradient in polygon

Returns:

  • (nil)


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

static VALUE
rb_plplot_plgradient(VALUE vmod, VALUE vx, VALUE vy, VALUE vdegrees)
{
  PLFLT *px, *py, degrees;
  int size;

  vx = rb_plplot_fltary(vx); px = NA_PTR_PLFLT(vx);
  vy = rb_plplot_fltary(vy); py = NA_PTR_PLFLT(vy);
  size = min(NA_TOTAL(vx), NA_TOTAL(vy));
  degrees = NUM2DBL(vdegrees);

  PLSYNC(plgradient, size, px, py, degrees);

  return Qnil;
}

.plgriddata(x, y, z, zg, type, data = nil, xg = nil, yg = nil) ⇒ nil

Grid data from irregularly sampled data.

x, y, z represent the irregularly sampled data.

zg is the 2D array into which the data will be gridded.

type specifies the gridding algortihm. It can be one of:

PL::GRID_CSA     Bivariate Cubic Spline approximation
PL::GRID_DTLI    Delaunay Triangulation Linear Interpolation
PL::GRID_NNI     Natural Neighbors Interpolation
PL::GRID_NNIDW   Nearest Neighbors Inverse Distance Weighted
PL::GRID_NNLI    Nearest Neighbors Linear Interpolation
PL::GRID_NNAIDW  Nearest Neighbors Around Inverse Distance Weighted

data provides some extra data to some of the gridding algorithms:

PL::GRID_NNI     only weights greater than data will be accepted. If 0,
                 all weights will be accepted.  The default of nil is
                 treated as -PLFLT_MAX (i.e. accept all data).

PL::GRID_NNIDW   data specifies the number of neighbors to use, the lower
                 the value, the noisier (more local) the approximation is.
                 The default of nil is treated as 15.

PL::GRID_NNLI    data specifies what a thin triangle is, in the range
                 1.0 to 2.0, inclusive.  High values enable the usage of
                 very thin triangles for interpolation, possibly resulting
                 in error in the approximation.  The default of nil is
                 treated as 1.001.

By default, the 2D grid spacing is equidistant from x.min to x.max in the x direction and from y.min to y.max in the y direction. To get other spacings, xg and yg can be given. If given as a Range, the output grid will be equally spaced from the beginning to the end of the range (always inclusive). If given as an array of explicit values, it must have the same length as the corresponding dimension in zg.

Returns:

  • (nil)


880
881
882
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
909
910
911
912
913
914
915
916
917
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
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
# File 'ext/rbplplot.c', line 880

static VALUE
rb_plplot_plgriddata(int argc, VALUE *argv, VALUE mod)
{
  VALUE vx, vy, vz, vzg, vtype, vdata=Qnil, vxg=Qnil, vyg=Qnil;
  PLFLT *px, *py, *pz, *pzg;
  PLINT nxyz;
  PLINT nxg, nyg, type;
  PLFLT *pxg=NULL, *pyg=NULL;
  PLFLT data=0.0;
  PLFLT xmin=0.0, xmax=0.0, dx=0.0, xx=0.0, ymin=0.0, ymax=0.0, dy=0.0, yy=0.0;
  int xg_alloc=0, yg_alloc=0;
  PLFLT *pbuf=NULL;
  int i=0;
  PLfGrid zg;

  rb_scan_args(argc, argv, "53", &vx, &vy, &vz, &vzg, &vtype, &vdata, &vxg, &vyg);

  vx  = rb_plplot_fltary(vx);  px  = NA_PTR_PLFLT(vx);
  vy  = rb_plplot_fltary(vy);  py  = NA_PTR_PLFLT(vy);
  vz  = rb_plplot_fltary(vz);  pz  = NA_PTR_PLFLT(vz);

  nxyz = min(NA_TOTAL(vx), NA_TOTAL(vy));
  nxyz = min(nxyz, NA_TOTAL(vz));

  vzg = rb_plplot_fltary(vzg); pzg = NA_PTR_PLFLT(vzg);
  nxg = NA_SHAPE1(vzg);
  nyg = NA_SHAPE0(vzg);
  type = NUM2INT(vtype);

  if(!NIL_P(vdata))
    data = NUM2DBL(vdata);
  else {
    /* Defaults from plplot's src/plgridd.c */
    switch(type) {
      case GRID_NNI: data = -PLFLT_MAX; break;
      case GRID_NNIDW: data = 15.0; break;
      case GRID_NNLI: data = 1.001; break;
    }
  }

  /* Validate both gx and gy args before doing any allocations */

  if(!NIL_P(vxg) && !rb_obj_is_kind_of(vxg, rb_cRange)) {
    /* non-nil and non-Range xg */
    vxg = rb_plplot_fltary(vxg);
    if(nxg != NA_TOTAL(vxg))
      rb_raise(rb_eArgError, "gx has %d elements, but x dimension of gz is %d", NA_TOTAL(vxg), nxg);
    pxg = NA_PTR_PLFLT(vxg);
  } else {
    /* nil or Range xg will need allocation */
    xg_alloc = nxg;
    /* Get xmin,xmax defaults from vx */
    rb_plplot_minmax(vx, &xmin, &xmax);
    /* Get xmin,xmax from vxg Range */
    rb_get_flt_pair(vxg, &xmin, &xmax, xmin, xmax);
    dx = (xmax-xmin) / (nxg-1);
  }

  /* non-nil and non-Range yg */
  if(!NIL_P(vyg) && !rb_obj_is_kind_of(vyg, rb_cRange)) {
    vyg = rb_plplot_fltary(vyg);
    if(nyg != NA_TOTAL(vyg))
      rb_raise(rb_eArgError, "gy has %d elements, but y dimension of gz is %d", NA_TOTAL(vyg), nyg);
    pyg = NA_PTR_PLFLT(vyg);
  } else {
    /* nil or Range yg will need allocation */
    yg_alloc = nyg;
    /* Get ymin,ymax defaults from vy */
    rb_plplot_minmax(vy, &ymin, &ymax);
    /* Get ymin,ymax from vyg Range */
    rb_get_flt_pair(vyg, &ymin, &ymax, ymin, ymax);
    dy = (ymax-ymin) / (nyg-1);
  }

  /*
   * Do one and only one allocation, to simplify exception handling.  ALLOC_N
   * calls GC if needed which is nice, but also raises NoMemError if it fails.
   * Doing two allocations means that an exception thrown during the second
   * allocation would need to be caught so that the memory allocated by the
   * first allocation could be freed.  Doing one combined allocation eliminates
   * the need for worrying about that scenario.
   */

  if(xg_alloc > 0 || yg_alloc > 0) {
    pbuf = ALLOC_N(PLFLT, xg_alloc + yg_alloc);
    if(xg_alloc > 0) {
      pxg = pbuf;
      for(i=0, xx=xmin; i<nxg; i++, xx+=dx)
        pxg[i] = xx;
    }
    if(yg_alloc > 0) {
      pyg = pbuf + xg_alloc; /* Skip xg, if any */
      for(i=0, yy=ymin; i<nyg; i++, yy+=dy) {
        pyg[i] = yy;
      }
    }
  }

  zg.f = pzg;
  zg.nx = nxg;
  zg.ny = nyg;

  plfgriddata(px, py, pz, nxyz, pxg, nxg, pyg, nyg, PLF2OPS_NA, &zg, type, data);

  return Qnil;
}

.plgspaArray

Get current subpage parameters

Returns:

  • (Array)


2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
# File 'ext/rbplplot.c', line 2982

static VALUE
rb_mPLplot_plgspa(VALUE obj)
{
  PLFLT ovar0;
  PLFLT ovar1;
  PLFLT ovar2;
  PLFLT ovar3;
  
  plgspa(&ovar0,&ovar1,&ovar2,&ovar3);
  return rb_ary_new3(4,
    rb_float_new(ovar0),
    rb_float_new(ovar1),
    rb_float_new(ovar2),
    rb_float_new(ovar3)
  );
}

.plgstrmObject

Get current stream number



3005
3006
3007
3008
3009
3010
3011
3012
# File 'ext/rbplplot.c', line 3005

static VALUE
rb_mPLplot_plgstrm(VALUE obj)
{
  PLINT ovar0;
  
  plgstrm(&ovar0);
  return LONG2NUM(ovar0);
}

.plgverObject

Get the current library version number



3020
3021
3022
3023
3024
3025
3026
3027
# File 'ext/rbplplot.c', line 3020

static VALUE
rb_mPLplot_plgver(VALUE obj)
{
  char ovar0[100] = {'\0'};
  
  plgver(ovar0);
  return rb_str_new2(ovar0);
}

.plgvpdArray

Get viewport limits in normalized device coordinates

Returns:

  • (Array)


3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
# File 'ext/rbplplot.c', line 3035

static VALUE
rb_mPLplot_plgvpd(VALUE obj)
{
  PLFLT ovar0;
  PLFLT ovar1;
  PLFLT ovar2;
  PLFLT ovar3;
  
  plgvpd(&ovar0,&ovar1,&ovar2,&ovar3);
  return rb_ary_new3(4,
    rb_float_new(ovar0),
    rb_float_new(ovar1),
    rb_float_new(ovar2),
    rb_float_new(ovar3)
  );
}

.plgvpwArray

Get viewport limits in world coordinates

Returns:

  • (Array)


3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
# File 'ext/rbplplot.c', line 3058

static VALUE
rb_mPLplot_plgvpw(VALUE obj)
{
  PLFLT ovar0;
  PLFLT ovar1;
  PLFLT ovar2;
  PLFLT ovar3;
  
  plgvpw(&ovar0,&ovar1,&ovar2,&ovar3);
  return rb_ary_new3(4,
    rb_float_new(ovar0),
    rb_float_new(ovar1),
    rb_float_new(ovar2),
    rb_float_new(ovar3)
  );
}

.plgxaxArray

Get x axis parameters

Returns:

  • (Array)


3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
# File 'ext/rbplplot.c', line 3081

static VALUE
rb_mPLplot_plgxax(VALUE obj)
{
  PLINT ovar0;
  PLINT ovar1;
  
  plgxax(&ovar0,&ovar1);
  return rb_ary_new3(2,
    LONG2NUM(ovar0),
    LONG2NUM(ovar1)
  );
}

.plgyaxArray

Get y axis parameters

Returns:

  • (Array)


3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
# File 'ext/rbplplot.c', line 3100

static VALUE
rb_mPLplot_plgyax(VALUE obj)
{
  PLINT ovar0;
  PLINT ovar1;
  
  plgyax(&ovar0,&ovar1);
  return rb_ary_new3(2,
    LONG2NUM(ovar0),
    LONG2NUM(ovar1)
  );
}

.plgzaxArray

Get z axis parameters

Returns:

  • (Array)


3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
# File 'ext/rbplplot.c', line 3119

static VALUE
rb_mPLplot_plgzax(VALUE obj)
{
  PLINT ovar0;
  PLINT ovar1;
  
  plgzax(&ovar0,&ovar1);
  return rb_ary_new3(2,
    LONG2NUM(ovar0),
    LONG2NUM(ovar1)
  );
}

.plhist(data, nbin, range = nil, opt = PL_BIN_DEFAULT) ⇒ nil

Plot a histogram from unbinned data

Returns:

  • (nil)


994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
# File 'ext/rbplplot.c', line 994

static VALUE
rb_plplot_plhist(int argc, VALUE *argv, VALUE mod)
{
  VALUE vdata, vnbin, vrange, vopt;
  VALUE vmin, vmax;
  PLINT nbin, opt, size;
  PLFLT *data, min, max;

  vmin = vmax = Qnil;

  rb_scan_args(argc, argv, "22", &vdata, &vnbin, &vrange, &vopt);

  if(vrange != Qnil && !rb_obj_is_kind_of(vrange, rb_cRange)) {
    rb_raise(rb_eTypeError,
        "wrong argument type %s for range (expected nil or Range)",
        rb_obj_classname(vrange));
  }

  vdata = rb_plplot_fltary(vdata); data = NA_PTR_PLFLT(vdata);
  nbin = NUM2INT(vnbin);
  opt = PL_HIST_DEFAULT;
  size = NA_TOTAL(vdata);

  /*
   * Could be an if statement, but use switch to be consistent with other
   * functions.
   */
  switch(argc) {
    case 4: opt = NUM2INT(vopt);
  }

  /* Cannot use argc for this test since nil could be passed explicitly */
  if(vrange != Qnil) {
    min = NUM2DBL(rb_funcall(vrange, id_beg, 0));
    max = NUM2DBL(rb_funcall(vrange, id_end, 0));
  } else {
    rb_plplot_minmax(vdata, &min, &max);
  }

  PLSYNC(plhist, size, data, min, max, nbin, opt);

  return Qnil;
}

.plhlsrgb(h, l, s) ⇒ Array

Convert HLS color to RGB

Returns:

  • (Array)


3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
# File 'ext/rbplplot.c', line 3138

static VALUE
rb_mPLplot_plhlsrgb(VALUE obj,VALUE arg0,VALUE arg1,VALUE arg2)
{
  PLFLT ivar0;
  PLFLT ivar1;
  PLFLT ivar2;
  PLFLT ovar0;
  PLFLT ovar1;
  PLFLT ovar2;
  ivar0 = NUM2DBL(arg0);
  ivar1 = NUM2DBL(arg1);
  ivar2 = NUM2DBL(arg2);
  plhlsrgb(ivar0,ivar1,ivar2,&ovar0,&ovar1,&ovar2);
  return rb_ary_new3(3,
    rb_float_new(ovar0),
    rb_float_new(ovar1),
    rb_float_new(ovar2)
  );
}

.plimage(idata, x_range, y_range, z_range, c_range = nil) ⇒ nil .plimage(idata, x_range, y_range, z_range, c_range = nil) {|x, y| ... } ⇒ nil .plimage(idata, x_range, y_range, z_range, c_range, x, y) ⇒ nil .plimage(idata, x_range, y_range, z_range, dx_range, dy_range) ⇒ nil

First three forms invoke plimagefr, last form invokes plimage.

For both forms:

idata is 2d image data
x_range is xmin..xmax
y_range is ymin..ymax
z_range is zmin..zmax

For plimagefr form:

c_range is valuemin..valuemax

For plimage form:

dx_range is dxmin..dxmax
dy_range is dymin..dymax

plimagefr form with x and y uses PLplot’s pltr1 transform if x and y are one dimensional or PLplot’s pltr2p transform if x or y are two dimensional.

Other plimagefr forms use the Ruby block transform, if given, or PLplot’s pltr0 identity transform if no block is given.

For both forms, exclusivity of Range objects is ignored unless end value is an Integer.

Overloads:

  • .plimage(idata, x_range, y_range, z_range, c_range = nil) ⇒ nil

    Returns:

    • (nil)
  • .plimage(idata, x_range, y_range, z_range, c_range = nil) {|x, y| ... } ⇒ nil

    Yields:

    • (x, y)

    Returns:

    • (nil)
  • .plimage(idata, x_range, y_range, z_range, c_range, x, y) ⇒ nil

    Returns:

    • (nil)
  • .plimage(idata, x_range, y_range, z_range, dx_range, dy_range) ⇒ nil

    Returns:

    • (nil)


1073
1074
1075
1076
1077
1078
1079
1080
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
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
# File 'ext/rbplplot.c', line 1073

static VALUE
rb_plplot_plimage(int argc, VALUE *argv, VALUE mod)
{
  VALUE vidata, vxrng, vyrng, vzrng, v4=Qnil, v5=Qnil, v6=Qnil, v7=Qnil;
  int do_plimagefr=0;
  PLfGrid gidata;
  PLFLT xmin=0.0, xmax=0.0;
  PLFLT ymin=0.0, ymax=0.0;
  PLFLT zmin=0.0, zmax=0.0;
  PLFLT cmin=0.0, cmax=0.0;
  PLFLT dxmin=0.0, dxmax=0.0;
  PLFLT dymin=0.0, dymax=0.0;
  PLcGrid gt;
  void (*pltr)(PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer);
  int block_given = rb_block_given_p();

  rb_scan_args(argc, argv, "43",
      &vidata, &vxrng, &vyrng, &vzrng, &v4, &v5, &v6, &v7);

  vidata = rb_plplot_fltary(vidata); gidata.f = NA_PTR_PLFLT(vidata);
  gidata.nx = NA_SHAPE1(vidata);
  gidata.ny = NA_SHAPE0(vidata);

  rb_get_flt_pair(vxrng, &xmin, &xmax, 0.0, gt.nx-1);
  rb_get_flt_pair(vyrng, &ymin, &ymax, 0.0, gt.ny-1);
  rb_get_flt_pair(vzrng, &zmin, &zmax, 0.0, 1.0);

  /* Warn if unnecessary block given */
  if(block_given && argc > 5) {
    rb_warning("unnecessary block given");
  }

  if(argc != 6) {
    /* plimage_fr forms */
    do_plimagefr = 1;

    /* Get cmin,cmax defaults from vidata */
    rb_plplot_minmax(vidata, &cmin, &cmax);
    /* Get cmin,cmax from c_range */
    rb_get_flt_pair(v4, &cmin, &cmax, cmin, cmax);

    /* Setup for pltr proc */
    gt.nx = gidata.nx + 1;
    gt.ny = gidata.ny + 1;
    rb_setup_pltr(v5, v6, &gt, &pltr);
  } else {
    /* plimage forms */
    /* Use xmin,xmax as defaults for dxmin,dxmax */
    dxmin = xmin; dxmax = xmax;
    /* Get dxmin,dxmax from dx_range */
    rb_get_flt_pair(v4, &dxmin, &dxmax, dxmin, dxmax);

    /* Use ymin,ymax as defaults for dymin,dymax */
    dymin = ymin; dymax = ymax;
    /* Get dymin,dymax from dy_range */
    rb_get_flt_pair(v5, &dymin, &dymax, dymin, dymax);
  }

  if(do_plimagefr)
    PLSYNC(plfimagefr, PLF2OPS_NA, &gidata, gidata.nx, gidata.ny, xmin, xmax, ymin, ymax, zmin, zmax, cmin, cmax, pltr, &gt);
  else
    PLSYNC(plfimage, PLF2OPS_NA, &gidata, gidata.nx, gidata.ny, xmin, xmax, ymin, ymax, zmin, zmax, dxmin, dxmax, dymin, dymax);

  return Qnil;
}

.pljoin(x1, y1, x2, y2) ⇒ nil

Draw a line between two points

Returns:

  • (nil)


3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
# File 'ext/rbplplot.c', line 3164

static VALUE
rb_mPLplot_pljoin(VALUE obj,VALUE arg0,VALUE arg1,VALUE arg2,VALUE arg3)
{
  PLFLT ivar0;
  PLFLT ivar1;
  PLFLT ivar2;
  PLFLT ivar3;
  ivar0 = NUM2DBL(arg0);
  ivar1 = NUM2DBL(arg1);
  ivar2 = NUM2DBL(arg2);
  ivar3 = NUM2DBL(arg3);
  PLSYNC(pljoin,ivar0,ivar1,ivar2,ivar3);
  return Qnil;
}

.pllab(xlabel, ylabel, tlabel) ⇒ nil

Simple routine to write labels

Returns:

  • (nil)


3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
# File 'ext/rbplplot.c', line 3185

static VALUE
rb_mPLplot_pllab(VALUE obj,VALUE arg0,VALUE arg1,VALUE arg2)
{
  char * ivar0;
  char * ivar1;
  char * ivar2;
  arg0 = rb_obj_as_string(arg0); ivar0 = StringValuePtr(arg0);
  arg1 = rb_obj_as_string(arg1); ivar1 = StringValuePtr(arg1);
  arg2 = rb_obj_as_string(arg2); ivar2 = StringValuePtr(arg2);
  PLSYNC(pllab,ivar0,ivar1,ivar2);
  return Qnil;
}

.pllightsource(x, y, z) ⇒ nil

Sets the 3D position of the light source

Returns:

  • (nil)


3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
# File 'ext/rbplplot.c', line 3204

static VALUE
rb_mPLplot_pllightsource(VALUE obj,VALUE arg0,VALUE arg1,VALUE arg2)
{
  PLFLT ivar0;
  PLFLT ivar1;
  PLFLT ivar2;
  ivar0 = NUM2DBL(arg0);
  ivar1 = NUM2DBL(arg1);
  ivar2 = NUM2DBL(arg2);
  PLSYNC(pllightsource,ivar0,ivar1,ivar2);
  return Qnil;
}

.plline(x, y) ⇒ nil

Draw a line

Returns:

  • (nil)


1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
# File 'ext/rbplplot.c', line 1145

static VALUE
rb_plplot_plline(VALUE mod, VALUE vx, VALUE vy)
{
  PLFLT x1, y1;
  PLFLT *px, *py;
  int size;

  /* Allow a line plot of a single point if x and y are scalars*/
  if(rb_obj_is_kind_of(vx, rb_cNumeric)) {
    x1 = NUM2DBL(vx); px = &x1;
    y1 = NUM2DBL(vy); py = &y1;
    size = 1;
  } else {
    vx = rb_plplot_fltary(vx); px = NA_PTR_PLFLT(vx);
    vy = rb_plplot_fltary(vy); py = NA_PTR_PLFLT(vy);
    size = min(NA_TOTAL(vx), NA_TOTAL(vy));
  }

  PLSYNC(plline, size, px, py);

  return Qnil;
}

.plline3(x, y, z) ⇒ nil

Draw a line in 3 space

Returns:

  • (nil)


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
# File 'ext/rbplplot.c', line 1174

static VALUE
rb_plplot_plline3(VALUE mod, VALUE vx, VALUE vy, VALUE vz)
{
  PLFLT x1, y1, z1;
  PLFLT *px, *py, *pz;
  int size;


  /* Allow a line3 plot of a single point if x,y,z are scalars*/
  if(rb_obj_is_kind_of(vx, rb_cNumeric)) {
    x1 = NUM2DBL(vx); px = &x1;
    y1 = NUM2DBL(vy); py = &y1;
    z1 = NUM2DBL(vz); pz = &z1;
    size = 1;
  } else {
    vx = rb_plplot_fltary(vx); px = NA_PTR_PLFLT(vx);
    vy = rb_plplot_fltary(vy); py = NA_PTR_PLFLT(vy);
    vz = rb_plplot_fltary(vz); pz = NA_PTR_PLFLT(vz);
    size = min(NA_TOTAL(vx), NA_TOTAL(vy));
    size = min(size,NA_TOTAL(vz));
  }

  PLSYNC(plline3, size, px, py, pz);

  return Qnil;
}

.pllsty(n) ⇒ nil

Select line style

Returns:

  • (nil)


3223
3224
3225
3226
3227
3228
3229
3230
# File 'ext/rbplplot.c', line 3223

static VALUE
rb_mPLplot_pllsty(VALUE obj,VALUE arg0)
{
  PLINT ivar0;
  ivar0 = NUM2LONG(arg0);
  pllsty(ivar0);
  return Qnil;
}

.plmesh(x, y, z, opt = nil, clevel = nil) ⇒ nil .plmeshc(x, y, z, opt = nil, clevel = nil) ⇒ nil

Plot surface mesh, optionally magnitude colored and/or with contours

Overloads:

  • .plmesh(x, y, z, opt = nil, clevel = nil) ⇒ nil

    Returns:

    • (nil)
  • .plmeshc(x, y, z, opt = nil, clevel = nil) ⇒ nil

    Returns:

    • (nil)


1265
1266
1267
1268
1269
1270
1271
# File 'ext/rbplplot.c', line 1265

static VALUE
rb_plplot_plmesh(int argc, VALUE *argv, VALUE mod)
{
  plplot_pl3d(argc, argv, 'm');

  return Qnil;
}

.plMinMax2dGrid(z) ⇒ Array

Find the minimum and maximum of a 2d NArray.

Returns:

  • (Array)


2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
# File 'ext/rbplplot.c', line 2179

static VALUE
rb_plplot_plMinMax2dGrid(VALUE mod, VALUE vz)
{
  PLFLT zmin, zmax;

  vz = rb_plplot_fltary(vz);
  rb_plplot_minmax(vz, &zmin, &zmax);

  return rb_ary_new3(2, rb_float_new(zmin), rb_float_new(zmax));
}

.plmkstrmObject

Creates a new stream and makes it the default



3238
3239
3240
3241
3242
3243
3244
3245
# File 'ext/rbplplot.c', line 3238

static VALUE
rb_mPLplot_plmkstrm(VALUE obj)
{
  PLINT ovar0;
  
  plmkstrm(&ovar0);
  return LONG2NUM(ovar0);
}

.plmtex(side, disp, pos, just, text) ⇒ nil

Write text relative to viewport boundaries

Returns:

  • (nil)


3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
# File 'ext/rbplplot.c', line 3253

static VALUE
rb_mPLplot_plmtex(VALUE obj,VALUE arg0,VALUE arg1,VALUE arg2,VALUE arg3,VALUE arg4)
{
  char * ivar0;
  PLFLT ivar1;
  PLFLT ivar2;
  PLFLT ivar3;
  char * ivar4;
  arg0 = rb_obj_as_string(arg0); ivar0 = StringValuePtr(arg0);
  ivar1 = NUM2DBL(arg1);
  ivar2 = NUM2DBL(arg2);
  ivar3 = NUM2DBL(arg3);
  arg4 = rb_obj_as_string(arg4); ivar4 = StringValuePtr(arg4);
  PLSYNC(plmtex,ivar0,ivar1,ivar2,ivar3,ivar4);
  return Qnil;
}

.plmtex3(side, disp, pos, just, text) ⇒ nil

Write text relative to viewport boundaries in 3D plots.

Returns:

  • (nil)


3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
# File 'ext/rbplplot.c', line 3276

static VALUE
rb_mPLplot_plmtex3(VALUE obj,VALUE arg0,VALUE arg1,VALUE arg2,VALUE arg3,VALUE arg4)
{
  char * ivar0;
  PLFLT ivar1;
  PLFLT ivar2;
  PLFLT ivar3;
  char * ivar4;
  arg0 = rb_obj_as_string(arg0); ivar0 = StringValuePtr(arg0);
  ivar1 = NUM2DBL(arg1);
  ivar2 = NUM2DBL(arg2);
  ivar3 = NUM2DBL(arg3);
  arg4 = rb_obj_as_string(arg4); ivar4 = StringValuePtr(arg4);
  PLSYNC(plmtex3,ivar0,ivar1,ivar2,ivar3,ivar4);
  return Qnil;
}

.plot3d(x, y, z, opt = nil, clevel = nil) ⇒ nil .plot3dc(x, y, z, opt = nil, clevel = nil) ⇒ nil

If clevel is true (or non-zero Fixnum), draw sides (same as including PL::DRAW_SIDES in opt), but not contours. If clevel is false (or zero Fixnum), do not draw sides (even if opt includes PL::DRAW_SIDES) and do not draw contours. Otherwise, sides are drawn if PL::DRAW_SIDES is in opt and contours are drawn at the levels specified in clevel if it is non-nil.

Overloads:

  • .plot3d(x, y, z, opt = nil, clevel = nil) ⇒ nil

    Returns:

    • (nil)
  • .plot3dc(x, y, z, opt = nil, clevel = nil) ⇒ nil

    Returns:

    • (nil)


1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
# File 'ext/rbplplot.c', line 1286

static VALUE
rb_plplot_plot3d(int argc, VALUE *argv, VALUE mod)
{
  int opt;
  VALUE vc;

  if(argc > 4) {
    opt = NUM2INT(argv[3]);
    vc = argv[4];

    if(TYPE(vc) == T_FIXNUM)
      vc = (vc == Qzero) ? Qfalse : Qtrue;

    if(vc == Qtrue) {
      opt |= DRAW_SIDES;
      argv[3] = INT2NUM(opt);
      argv[4] = Qnil;
    } else if(vc == Qfalse) {
      opt &= ~DRAW_SIDES;
      argv[3] = INT2NUM(opt);
      argv[4] = Qnil;
    }
  }

  plplot_pl3d(argc, argv, 'p');

  return Qnil;
}

.plpat(inclin, delta) ⇒ nil

Set area fill pattern

inclin and delata must be scalar or 1 or 2 element arrays.

Returns:

  • (nil)


1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
# File 'ext/rbplplot.c', line 1325

static VALUE
rb_plplot_plpat(VALUE mod, VALUE vinc, VALUE vdel)
{
  PLINT *pinc, *pdel;
  unsigned int size;

  vinc = rb_plplot_intary(vinc); pinc = NA_PTR_PLINT(vinc);
  vdel = rb_plplot_intary(vdel); pdel = NA_PTR_PLINT(vdel);
  size = min(NA_TOTAL(vinc), NA_TOTAL(vdel));

  plpat(size, pinc, pdel);

  return Qnil;
}

.plpoin(x, y, sym = 9) ⇒ nil

Plots a character at the specified points

Returns:

  • (nil)


1383
1384
1385
1386
1387
1388
# File 'ext/rbplplot.c', line 1383

static VALUE
rb_plplot_plpoin(int argc, VALUE *argv, VALUE mod)
{
  plplot_plpoinsym(argc, argv, 'p');
  return Qnil;
}

.plpoin3(x, y, z, sym = 9) ⇒ nil

Plots a character at the specified points in 3 space

Returns:

  • (nil)


1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
# File 'ext/rbplplot.c', line 1396

static VALUE
rb_plplot_plpoin3(int argc, VALUE *argv, VALUE mod)
{
  VALUE vx, vy, vz, vcode;
  PLFLT x1, y1, z1;
  PLFLT *px, *py, *pz;
  int code = 9;
  unsigned int size;

  rb_scan_args(argc, argv, "31", &vx, &vy, &vz, &vcode);

  if(rb_obj_is_kind_of(vx, rb_cNumeric)) {
    x1 = NUM2DBL(vx); px = &x1;
    y1 = NUM2DBL(vy); py = &y1;
    z1 = NUM2DBL(vz); pz = &z1;
    size = 1;
  } else {
    vx = rb_plplot_fltary(vx); px = NA_PTR_PLFLT(vx);
    vy = rb_plplot_fltary(vy); py = NA_PTR_PLFLT(vy);
    vz = rb_plplot_fltary(vz); pz = NA_PTR_PLFLT(vz);
    size = min(NA_TOTAL(vx), NA_TOTAL(vy));
    size = min(size,NA_TOTAL(vz));
  }

  /*
   * Could be an if statement, but use switch to be consistent with other
   * functions.
   */
  switch(argc) {
    case 4: code = NUM2INT(vcode);
  }

  PLSYNC(plpoin3, size, px, py, pz, code);

  return Qnil;
}

.plpoly3(x, y, z, draw, cc) ⇒ nil

Draw a polygon in 3 space

Returns:

  • (nil)


1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
# File 'ext/rbplplot.c', line 1439

static VALUE
rb_plplot_plpoly3(VALUE mod, VALUE vx, VALUE vy, VALUE vz, VALUE vdraw, VALUE vcc)
{
  PLFLT *px, *py, *pz;
  PLINT *pdraw;
  PLBOOL cc;
  int size;

  vx = rb_plplot_fltary(vx); px = NA_PTR_PLFLT(vx);
  vy = rb_plplot_fltary(vy); py = NA_PTR_PLFLT(vy);
  vz = rb_plplot_fltary(vz); pz = NA_PTR_PLFLT(vz);
  vdraw = rb_plplot_intary(vdraw); pdraw = NA_PTR_PLINT(vdraw);
  size = min(NA_TOTAL(vx), NA_TOTAL(vy));
  size = min(size,NA_TOTAL(vz));
  size = min(size,NA_TOTAL(vdraw));

  cc = PL_RTEST(vcc);

  PLSYNC(plpoly3, size, px, py, pz, pdraw, cc);

  return Qnil;
}

.plprec(set, prec) ⇒ nil

Set precision in numeric labels

Returns:

  • (nil)


3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
# File 'ext/rbplplot.c', line 3299

static VALUE
rb_mPLplot_plprec(VALUE obj,VALUE arg0,VALUE arg1)
{
  PLINT ivar0;
  PLINT ivar1;
  ivar0 = NUM2LONG(arg0);
  ivar1 = NUM2LONG(arg1);
  plprec(ivar0,ivar1);
  return Qnil;
}

.plpsty(n) ⇒ nil

Select area fill pattern

Returns:

  • (nil)


3316
3317
3318
3319
3320
3321
3322
3323
# File 'ext/rbplplot.c', line 3316

static VALUE
rb_mPLplot_plpsty(VALUE obj,VALUE arg0)
{
  PLINT ivar0;
  ivar0 = NUM2LONG(arg0);
  plpsty(ivar0);
  return Qnil;
}

.plptex(x, y, dx, dy, just, text) ⇒ nil

Write text inside the viewport

Returns:

  • (nil)


3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
# File 'ext/rbplplot.c', line 3331

static VALUE
rb_mPLplot_plptex(VALUE obj,VALUE arg0,VALUE arg1,VALUE arg2,VALUE arg3,VALUE arg4,VALUE arg5)
{
  PLFLT ivar0;
  PLFLT ivar1;
  PLFLT ivar2;
  PLFLT ivar3;
  PLFLT ivar4;
  char * ivar5;
  ivar0 = NUM2DBL(arg0);
  ivar1 = NUM2DBL(arg1);
  ivar2 = NUM2DBL(arg2);
  ivar3 = NUM2DBL(arg3);
  ivar4 = NUM2DBL(arg4);
  arg5 = rb_obj_as_string(arg5); ivar5 = StringValuePtr(arg5);
  PLSYNC(plptex,ivar0,ivar1,ivar2,ivar3,ivar4,ivar5);
  return Qnil;
}

.plptex3(x, y, z, dx, dy, dz, sx, sy, sz, just, text) ⇒ nil

Write text inside the viewport of a 3D plot.

Returns:

  • (nil)


3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
# File 'ext/rbplplot.c', line 3356

static VALUE
rb_mPLplot_plptex3(VALUE obj,VALUE arg0,VALUE arg1,VALUE arg2,VALUE arg3,VALUE arg4,VALUE arg5,VALUE arg6,VALUE arg7,VALUE arg8,VALUE arg9,VALUE arg10)
{
  PLFLT ivar0;
  PLFLT ivar1;
  PLFLT ivar2;
  PLFLT ivar3;
  PLFLT ivar4;
  PLFLT ivar5;
  PLFLT ivar6;
  PLFLT ivar7;
  PLFLT ivar8;
  PLFLT ivar9;
  char * ivar10;
  ivar0 = NUM2DBL(arg0);
  ivar1 = NUM2DBL(arg1);
  ivar2 = NUM2DBL(arg2);
  ivar3 = NUM2DBL(arg3);
  ivar4 = NUM2DBL(arg4);
  ivar5 = NUM2DBL(arg5);
  ivar6 = NUM2DBL(arg6);
  ivar7 = NUM2DBL(arg7);
  ivar8 = NUM2DBL(arg8);
  ivar9 = NUM2DBL(arg9);
  arg10 = rb_obj_as_string(arg10); ivar10 = StringValuePtr(arg10);
  PLSYNC(plptex3,ivar0,ivar1,ivar2,ivar3,ivar4,ivar5,ivar6,ivar7,ivar8,ivar9,ivar10);
  return Qnil;
}

.plranddFloat

Random number generator returning a real random number in the range [0,1].

Returns:

  • (Float)


1468
1469
1470
1471
1472
# File 'ext/rbplplot.c', line 1468

static VALUE
rb_plplot_plrandd(VALUE mod)
{
  return rb_float_new(plrandd());
}

.plreplotnil

Replays contents of plot buffer to current device/file

Returns:

  • (nil)


3391
3392
3393
3394
3395
3396
3397
3398
# File 'ext/rbplplot.c', line 3391

static VALUE
rb_mPLplot_plreplot(VALUE obj)
{
  
  
  PLSYNC(plreplot,);
  return Qnil;
}

.plrgbhls(r, g, b) ⇒ Array

Convert RGB color to HLS

Returns:

  • (Array)


3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
# File 'ext/rbplplot.c', line 3406

static VALUE
rb_mPLplot_plrgbhls(VALUE obj,VALUE arg0,VALUE arg1,VALUE arg2)
{
  PLFLT ivar0;
  PLFLT ivar1;
  PLFLT ivar2;
  PLFLT ovar0;
  PLFLT ovar1;
  PLFLT ovar2;
  ivar0 = NUM2DBL(arg0);
  ivar1 = NUM2DBL(arg1);
  ivar2 = NUM2DBL(arg2);
  plrgbhls(ivar0,ivar1,ivar2,&ovar0,&ovar1,&ovar2);
  return rb_ary_new3(3,
    rb_float_new(ovar0),
    rb_float_new(ovar1),
    rb_float_new(ovar2)
  );
}

.plschrnil

Set character size

Returns:

  • (nil)


3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
# File 'ext/rbplplot.c', line 3432

static VALUE
rb_mPLplot_plschr(VALUE obj,VALUE arg0,VALUE arg1)
{
  PLFLT ivar0;
  PLFLT ivar1;
  ivar0 = NUM2DBL(arg0);
  ivar1 = NUM2DBL(arg1);
  plschr(ivar0,ivar1);
  return Qnil;
}

.plscmap0(r, g, b) ⇒ nil

Set color map0 colors by 8-bit RGB values

Returns:

  • (nil)


1539
1540
1541
1542
1543
1544
# File 'ext/rbplplot.c', line 1539

static VALUE
rb_plplot_plscmap0(VALUE mod, VALUE vr, VALUE vg, VALUE vb)
{
  plplot_plscmap(0, vr, vg, vb);
  return Qnil;
}

.plscmap0a(r, g, b, a) ⇒ nil

Set color map0 colors by 8-bit RGB values and double alpha value.

Returns:

  • (nil)


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

static VALUE
rb_plplot_plscmap0a(VALUE mod, VALUE vr, VALUE vg, VALUE vb, VALUE va)
{
  plplot_plscmapa(0, vr, vg, vb, va);
  return Qnil;
}

.plscmap0n(ncol0) ⇒ nil

Set number of colors in color map0

Returns:

  • (nil)


3449
3450
3451
3452
3453
3454
3455
3456
# File 'ext/rbplplot.c', line 3449

static VALUE
rb_mPLplot_plscmap0n(VALUE obj,VALUE arg0)
{
  PLINT ivar0;
  ivar0 = NUM2LONG(arg0);
  PLSYNC(plscmap0n,ivar0);
  return Qnil;
}

.plscmap1(r, g, b) ⇒ nil

Set color map1 colors using 8-bit RGB values

Returns:

  • (nil)


1565
1566
1567
1568
1569
1570
# File 'ext/rbplplot.c', line 1565

static VALUE
rb_plplot_plscmap1(VALUE mod, VALUE vr, VALUE vg, VALUE vb)
{
  plplot_plscmap(1, vr, vg, vb);
  return Qnil;
}

.plscmap1a(r, g, b, a) ⇒ nil

Set color map1 colors using 8-bit RGB values and double alpha values.

Returns:

  • (nil)


1578
1579
1580
1581
1582
1583
# File 'ext/rbplplot.c', line 1578

static VALUE
rb_plplot_plscmap1a(VALUE mod, VALUE vr, VALUE vg, VALUE vb, VALUE va)
{
  plplot_plscmapa(1, vr, vg, vb, va);
  return Qnil;
}

.plscmap1l(type, pos, c1, c2, c3, rev = nil) ⇒ nil

Set color map1 colors using a piece-wise linear relationship

Returns:

  • (nil)


1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
# File 'ext/rbplplot.c', line 1591

static VALUE
rb_plplot_plscmap1l(int argc, VALUE *argv, VALUE mod)
{
  VALUE vtype, vpos, vc1, vc2, vc3, vrev;
  PLBOOL type;
  PLFLT *ppos, *pc1, *pc2, *pc3;
  PLBOOL *prev;
  unsigned int size;

  rb_scan_args(argc, argv, "51", &vtype, &vpos, &vc1, &vc2, &vc3, &vrev);

  type = PL_RTEST(vtype);
  vpos = rb_plplot_fltary(vpos); ppos = NA_PTR_PLFLT(vpos);
  vc1  = rb_plplot_fltary(vc1);  pc1  = NA_PTR_PLFLT(vc1);
  vc2  = rb_plplot_fltary(vc2);  pc2  = NA_PTR_PLFLT(vc2);
  vc3  = rb_plplot_fltary(vc3);  pc3  = NA_PTR_PLFLT(vc3);
  size = min(NA_TOTAL(vpos), NA_TOTAL(vc1));
  size = min(size,NA_TOTAL(vc2));
  size = min(size,NA_TOTAL(vc3));
  prev = NULL;

  /*
   * Could be an if statement, but use switch to be consistent with other
   * functions.
   */
  switch(argc) {
    case 6: if(vrev != Qnil) {
              vrev = rb_plplot_fltary(vrev); prev = NA_PTR_PLINT(vrev);
              size = min(size, NA_TOTAL(vrev));
            }
  }

  PLSYNC(plscmap1l,type,size,ppos,pc1,pc2,pc3,prev);

  return Qnil;
}

.plscmap1la(type, pos, c1, c2, c3, a, rev = nil) ⇒ nil

Set color map1 colors using a piece-wise linear relationship (with alpha). type should be PL::CMAP_RGB (in which case c1, c2, c3 are red, green, blue components) or PL::CMAP_HLS (in which case c1, c2, c3 are hue, luminance, saturation components).

Returns:

  • (nil)


1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
# File 'ext/rbplplot.c', line 1638

static VALUE
rb_plplot_plscmap1la(int argc, VALUE *argv, VALUE mod)
{
  VALUE vtype, vpos, vc1, vc2, vc3, vc4, vrev;
  PLINT type;
  PLFLT *ppos, *pc1, *pc2, *pc3, *pc4;
  PLBOOL *prev;
  unsigned int size;

  rb_scan_args(argc, argv, "61",
      &vtype, &vpos, &vc1, &vc2, &vc3, &vc4, &vrev);

  type = NUM2INT(vtype);
  vpos = rb_plplot_fltary(vpos); ppos = NA_PTR_PLFLT(vpos);
  vc1  = rb_plplot_fltary(vc1);  pc1  = NA_PTR_PLFLT(vc1);
  vc2  = rb_plplot_fltary(vc2);  pc2  = NA_PTR_PLFLT(vc2);
  vc3  = rb_plplot_fltary(vc3);  pc3  = NA_PTR_PLFLT(vc3);
  vc4  = rb_plplot_fltary(vc4);  pc4  = NA_PTR_PLFLT(vc4);
  size = min(NA_TOTAL(vpos), NA_TOTAL(vc1));
  size = min(size,NA_TOTAL(vc2));
  size = min(size,NA_TOTAL(vc3));
  size = min(size,NA_TOTAL(vc4));
  prev = NULL;

  /*
   * Could be an if statement, but use switch to be consistent with other
   * functions.
   */
  switch(argc) {
    case 7: if(vrev != Qnil) {
              vrev = rb_plplot_fltary(vrev); prev = NA_PTR_PLINT(vrev);
              size = min(size, NA_TOTAL(vrev));
            }
  }

  PLSYNC(plscmap1la,type,size,ppos,pc1,pc2,pc3,pc4,prev);

  return Qnil;
}

.plscmap1n(ncol1) ⇒ nil

Set number of colors in color map1

Returns:

  • (nil)


3464
3465
3466
3467
3468
3469
3470
3471
# File 'ext/rbplplot.c', line 3464

static VALUE
rb_mPLplot_plscmap1n(VALUE obj,VALUE arg0)
{
  PLINT ivar0;
  ivar0 = NUM2LONG(arg0);
  PLSYNC(plscmap1n,ivar0);
  return Qnil;
}

.plscol0(icol0, r, g, b) ⇒ nil

Set a given color from color map0 by 8 bit RGB value

Returns:

  • (nil)


3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
# File 'ext/rbplplot.c', line 3479

static VALUE
rb_mPLplot_plscol0(VALUE obj,VALUE arg0,VALUE arg1,VALUE arg2,VALUE arg3)
{
  PLINT ivar0;
  PLINT ivar1;
  PLINT ivar2;
  PLINT ivar3;
  ivar0 = NUM2LONG(arg0);
  ivar1 = NUM2LONG(arg1);
  ivar2 = NUM2LONG(arg2);
  ivar3 = NUM2LONG(arg3);
  PLSYNC(plscol0,ivar0,ivar1,ivar2,ivar3);
  return Qnil;
}

.plscol0a(icol0, r, g, b, a) ⇒ nil

Set a given color from color map0 by 8 bit RGB value and Float alpha value.

Returns:

  • (nil)


3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
# File 'ext/rbplplot.c', line 3500

static VALUE
rb_mPLplot_plscol0a(VALUE obj,VALUE arg0,VALUE arg1,VALUE arg2,VALUE arg3,VALUE arg4)
{
  PLINT ivar0;
  PLINT ivar1;
  PLINT ivar2;
  PLINT ivar3;
  PLFLT ivar4;
  ivar0 = NUM2LONG(arg0);
  ivar1 = NUM2LONG(arg1);
  ivar2 = NUM2LONG(arg2);
  ivar3 = NUM2LONG(arg3);
  ivar4 = NUM2DBL(arg4);
  PLSYNC(plscol0a,ivar0,ivar1,ivar2,ivar3,ivar4);
  return Qnil;
}

.plscolbg(r, g, b) ⇒ nil

Set the background color by 8-bit RGB value

Returns:

  • (nil)


3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
# File 'ext/rbplplot.c', line 3523

static VALUE
rb_mPLplot_plscolbg(VALUE obj,VALUE arg0,VALUE arg1,VALUE arg2)
{
  PLINT ivar0;
  PLINT ivar1;
  PLINT ivar2;
  ivar0 = NUM2LONG(arg0);
  ivar1 = NUM2LONG(arg1);
  ivar2 = NUM2LONG(arg2);
  PLSYNC(plscolbg,ivar0,ivar1,ivar2);
  return Qnil;
}

.plscolbga(r, g, b, a) ⇒ nil

Set the background color by 8-bit RGB value and Float alpha value.

Returns:

  • (nil)


3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
# File 'ext/rbplplot.c', line 3542

static VALUE
rb_mPLplot_plscolbga(VALUE obj,VALUE arg0,VALUE arg1,VALUE arg2,VALUE arg3)
{
  PLINT ivar0;
  PLINT ivar1;
  PLINT ivar2;
  PLFLT ivar3;
  ivar0 = NUM2LONG(arg0);
  ivar1 = NUM2LONG(arg1);
  ivar2 = NUM2LONG(arg2);
  ivar3 = NUM2DBL(arg3);
  PLSYNC(plscolbga,ivar0,ivar1,ivar2,ivar3);
  return Qnil;
}

.plscolor(bool) ⇒ nil

Used to globally turn color output on/off

Returns:

  • (nil)


3563
3564
3565
3566
3567
3568
3569
3570
# File 'ext/rbplplot.c', line 3563

static VALUE
rb_mPLplot_plscolor(VALUE obj,VALUE arg0)
{
  int ivar0;
  ivar0 = PL_RTEST(arg0);
  PLSYNC(plscolor,ivar0);
  return Qnil;
}

.plscompression(compression) ⇒ nil

Set device-compression level

Returns:

  • (nil)


3578
3579
3580
3581
3582
3583
3584
3585
# File 'ext/rbplplot.c', line 3578

static VALUE
rb_mPLplot_plscompression(VALUE obj,VALUE arg0)
{
  PLINT ivar0;
  ivar0 = NUM2LONG(arg0);
  plscompression(ivar0);
  return Qnil;
}

.plsdev(devname) ⇒ nil

Set the device (keyword) name

Returns:

  • (nil)


3593
3594
3595
3596
3597
3598
3599
3600
# File 'ext/rbplplot.c', line 3593

static VALUE
rb_mPLplot_plsdev(VALUE obj,VALUE arg0)
{
  char * ivar0;
  arg0 = rb_obj_as_string(arg0); ivar0 = StringValuePtr(arg0);
  plsdev(ivar0);
  return Qnil;
}

.plsdidev(mar, aspect, jx, jy) ⇒ nil

Set parameters that define current device-space window

Returns:

  • (nil)


3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
# File 'ext/rbplplot.c', line 3608

static VALUE
rb_mPLplot_plsdidev(VALUE obj,VALUE arg0,VALUE arg1,VALUE arg2,VALUE arg3)
{
  PLFLT ivar0;
  PLFLT ivar1;
  PLFLT ivar2;
  PLFLT ivar3;
  ivar0 = NUM2DBL(arg0);
  ivar1 = NUM2DBL(arg1);
  ivar2 = NUM2DBL(arg2);
  ivar3 = NUM2DBL(arg3);
  PLSYNC(plsdidev,ivar0,ivar1,ivar2,ivar3);
  return Qnil;
}

.plsdimap(dimxmin, dimxmax, dimymin, dimymax, dimxpmm, dimypmm) ⇒ nil

Set up transformation from metafile coordinates

Returns:

  • (nil)


3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
# File 'ext/rbplplot.c', line 3629

static VALUE
rb_mPLplot_plsdimap(VALUE obj,VALUE arg0,VALUE arg1,VALUE arg2,VALUE arg3,VALUE arg4,VALUE arg5)
{
  PLINT ivar0;
  PLINT ivar1;
  PLINT ivar2;
  PLINT ivar3;
  PLFLT ivar4;
  PLFLT ivar5;
  ivar0 = NUM2LONG(arg0);
  ivar1 = NUM2LONG(arg1);
  ivar2 = NUM2LONG(arg2);
  ivar3 = NUM2LONG(arg3);
  ivar4 = NUM2DBL(arg4);
  ivar5 = NUM2DBL(arg5);
  plsdimap(ivar0,ivar1,ivar2,ivar3,ivar4,ivar5);
  return Qnil;
}

.plsdiori(rot90) ⇒ nil

Set plot orientation

Returns:

  • (nil)


3654
3655
3656
3657
3658
3659
3660
3661
# File 'ext/rbplplot.c', line 3654

static VALUE
rb_mPLplot_plsdiori(VALUE obj,VALUE arg0)
{
  PLFLT ivar0;
  ivar0 = NUM2DBL(arg0);
  PLSYNC(plsdiori,ivar0);
  return Qnil;
}

.plsdiplt(xmin, ymin, xmax, ymax) ⇒ nil

Set parameters that define current plot-space window

Returns:

  • (nil)


3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
# File 'ext/rbplplot.c', line 3669

static VALUE
rb_mPLplot_plsdiplt(VALUE obj,VALUE arg0,VALUE arg1,VALUE arg2,VALUE arg3)
{
  PLFLT ivar0;
  PLFLT ivar1;
  PLFLT ivar2;
  PLFLT ivar3;
  ivar0 = NUM2DBL(arg0);
  ivar1 = NUM2DBL(arg1);
  ivar2 = NUM2DBL(arg2);
  ivar3 = NUM2DBL(arg3);
  PLSYNC(plsdiplt,ivar0,ivar1,ivar2,ivar3);
  return Qnil;
}

.plsdiplz(xmin, ymin, xmax, ymax) ⇒ nil

Set parameters incrementally (zoom mode) that define current plot-space window

Returns:

  • (nil)


3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
# File 'ext/rbplplot.c', line 3690

static VALUE
rb_mPLplot_plsdiplz(VALUE obj,VALUE arg0,VALUE arg1,VALUE arg2,VALUE arg3)
{
  PLFLT ivar0;
  PLFLT ivar1;
  PLFLT ivar2;
  PLFLT ivar3;
  ivar0 = NUM2DBL(arg0);
  ivar1 = NUM2DBL(arg1);
  ivar2 = NUM2DBL(arg2);
  ivar3 = NUM2DBL(arg3);
  PLSYNC(plsdiplz,ivar0,ivar1,ivar2,ivar3);
  return Qnil;
}

.plseed(seed) ⇒ nil

Set seed for internal random number generator.

Returns:

  • (nil)


3711
3712
3713
3714
3715
3716
3717
3718
# File 'ext/rbplplot.c', line 3711

static VALUE
rb_mPLplot_plseed(VALUE obj,VALUE arg0)
{
  PLINT ivar0;
  ivar0 = NUM2LONG(arg0);
  plseed(ivar0);
  return Qnil;
}

.plsesc(esc) ⇒ nil

Set the escape character for text strings

Returns:

  • (nil)


3726
3727
3728
3729
3730
3731
3732
3733
# File 'ext/rbplplot.c', line 3726

static VALUE
rb_mPLplot_plsesc(VALUE obj,VALUE arg0)
{
  PLINT ivar0;
  ivar0 = NUM2LONG(arg0);
  plsesc(ivar0);
  return Qnil;
}

.plsetopt(opt_ary, strict = false) ⇒ nil .plsetopt(opt_str, optarg = nil, strict = false) ⇒ nil

If the first argument is an Array, it is taken as a collection of PLplot command line options and arguments to set.

If the first argument is not an Array, it is taken as the option to set and optarg is its argument.

If strict is false, errors are silently ignored. If strict is true, errors are not silently ignored and they will cause PLplot (at least through version 5.9.5) to display its “short help” message and then exit the process. The PLplot options -h and -v with strict=true will show PLplot’s “long help” message and library version, respectively, and then exit.

# Show short PLplot help
# (and exit with PLplot version <= 5.9.5)
plsetopt(['-'], true)    # '-' alone is invalid option
plsetopt('-', nil, true) # (equivalent)

# Show short PLplot help including "invisible" options
# (and exit with PLplot version <= 5.9.5)
plsetopt(['showall', '-'], true)

# Show long PLplot help
# (and exit with PLplot version <= 5.9.5)
plsetopt(['h'], true)
plsetopt('h', nil, true) # (equivalent)

# Show long PLplot help including "invisible" options
# (and exit with PLplot version <= 5.9.5)
plsetopt(['showall', 'h'], true)

# Show PLplot library version
plsetopt(['v'], true)
plsetopt('v', nil, true) # (equivalent)

Note that options do not require (but may have) a leading dash.

Overloads:

  • .plsetopt(opt_ary, strict = false) ⇒ nil

    Returns:

    • (nil)
  • .plsetopt(opt_str, optarg = nil, strict = false) ⇒ nil

    Returns:

    • (nil)


1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
# File 'ext/rbplplot.c', line 1720

static VALUE
rb_plplot_plsetopt(int argc, VALUE *argv, VALUE mod)
{
  VALUE vopt, voptarg, vstrict;
  VALUE *vopts;
  int mode = PL_PARSE_NODELETE | PL_PARSE_NOPROGRAM | PL_PARSE_NODASH;
  int plargc;
  int i;
  const char **plargv;

  rb_scan_args(argc, argv, "12", &vopt, &voptarg, &vstrict);

  if(TYPE(vopt) == T_ARRAY) {
    /* Array processing */
    plargc = RARRAY_LEN(vopt);
    vopts = ALLOCA_N(VALUE, plargc);
    plargv = ALLOCA_N(const char *, plargc+1);
    for(i=0; i<plargc; i++) {
      vopts[i] = rb_ary_entry(vopt, i);
      vopts[i] = rb_obj_as_string(vopts[i]);
      plargv[i] = StringValuePtr(vopts[i]);
    }
    vstrict = voptarg;
  } else {
    /* String processing */
    plargc = 1;
    plargv = ALLOCA_N(const char *, 3);
    vopt = rb_obj_as_string(vopt);
    plargv[0] = StringValuePtr(vopt);
    if(argc > 1) {
      plargc = 2;
      voptarg = rb_obj_as_string(voptarg);
      plargv[1] = StringValuePtr(voptarg);
    }
  }
  plargv[plargc] = NULL;

  if(PL_RTEST(vstrict))
    mode |= PL_PARSE_FULL;
  else
    mode |= PL_PARSE_QUIET;

  plparseopts(&plargc, plargv, mode);

  return Qnil;
}

.plsfam(fam_bool, num, bmax) ⇒ nil

Set family file parameters

Returns:

  • (nil)


3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
# File 'ext/rbplplot.c', line 3741

static VALUE
rb_mPLplot_plsfam(VALUE obj,VALUE arg0,VALUE arg1,VALUE arg2)
{
  int ivar0;
  PLINT ivar1;
  PLINT ivar2;
  ivar0 = PL_RTEST(arg0);
  ivar1 = NUM2LONG(arg1);
  ivar2 = NUM2LONG(arg2);
  plsfam(ivar0,ivar1,ivar2);
  return Qnil;
}

.plsfci(fci) ⇒ nil

Set FCI (font characterization integer)

Returns:

  • (nil)


3760
3761
3762
3763
3764
3765
3766
3767
# File 'ext/rbplplot.c', line 3760

static VALUE
rb_mPLplot_plsfci(VALUE obj,VALUE arg0)
{
  PLUNICODE ivar0;
  ivar0 = NUM2UINT(arg0);
  plsfci(ivar0);
  return Qnil;
}

.plsfnam(output_filename) ⇒ nil

Set output file name

Returns:

  • (nil)


3775
3776
3777
3778
3779
3780
3781
3782
# File 'ext/rbplplot.c', line 3775

static VALUE
rb_mPLplot_plsfnam(VALUE obj,VALUE arg0)
{
  char * ivar0;
  arg0 = rb_obj_as_string(arg0); ivar0 = StringValuePtr(arg0);
  plsfnam(ivar0);
  return Qnil;
}

.plsfont(family, style, weight) ⇒ nil

Set family, style and weight of the current font

Returns:

  • (nil)


3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
# File 'ext/rbplplot.c', line 3790

static VALUE
rb_mPLplot_plsfont(VALUE obj,VALUE arg0,VALUE arg1,VALUE arg2)
{
  PLINT ivar0;
  PLINT ivar1;
  PLINT ivar2;
  ivar0 = NUM2LONG(arg0);
  ivar1 = NUM2LONG(arg1);
  ivar2 = NUM2LONG(arg2);
  plsfont(ivar0,ivar1,ivar2);
  return Qnil;
}

.plshade(z, x_range, y_range, sh_range, sh_color, sh_width, cont_color, cont_width, rectangular) ⇒ nil .plshade(z, x_range, y_range, sh_range, sh_color, sh_width, cont_color, cont_width, rectangular) {|x, y| ... } ⇒ nil .plshade(z, x_range, y_range, sh_range, sh_color, sh_width, cont_color, cont_width, rectangular, x, y) ⇒ nil .plshade(z, x_range, y_range, clevel, fill_width, cont_color, cont_width, rectangular) ⇒ nil .plshade(z, x_range, y_range, clevel, fill_width, cont_color, cont_width, rectangular) {|x, y| ... } ⇒ nil .plshade(z, x_range, y_range, clevel, fill_width, cont_color, cont_width, rectangular, x, y) ⇒ nil

First three forms invoke plshade1, last three forms invoke plshades.

For plshade1 form:

z is 2D data to be shaded
x_range is xmin..xmax (exclusivity of Range is ignored unless xmax is Integer)
y_range is ymin..ymax (exclusivity of Range is ignored unless ymax is Integer)
sh_range is sh_min..sh_max (exclusivity of Range is ignored unless sh_max is Integer)
sh_color is for cmap0 if it is a Fixnum or cmap1 if it is a Float
sh_width is the width used by the fill pattern
cont_color is min_color..max_color or [min_color, max_color] or scalar
cont_width is min_width..max_width or [min_width, max_width] or scalar
rectangular is true/false or zero/non-zero optimization hint

For plshades form:

z is 2D data to be shaded
x_range is xmin..xmax (exclusivity of Range is ignored unless xmax is Integer)
y_range is ymin..ymax (exclusivity of Range is ignored unless ymax is Integer)
clevel is NArray giving contour levels to shade
fill_width is the width used by the fill pattern
cont_color is scalar (nil is treated as 0)
cont_width is scalar (nil is treated as 0)
rectangular is true/false or zero/non-zero optimization hint

Forms with x and y use PLplot’s pltr1 transform if x and y are one dimensional or PLplot’s pltr2p transform if x or y are two dimensional.

Other forms use the Ruby block transform, if given; otherwise PLplot will synthesize an identity transform over (x_range, y_range) if no block is given.

Overloads:

  • .plshade(z, x_range, y_range, sh_range, sh_color, sh_width, cont_color, cont_width, rectangular) ⇒ nil

    Returns:

    • (nil)
  • .plshade(z, x_range, y_range, sh_range, sh_color, sh_width, cont_color, cont_width, rectangular) {|x, y| ... } ⇒ nil

    Yields:

    • (x, y)

    Returns:

    • (nil)
  • .plshade(z, x_range, y_range, sh_range, sh_color, sh_width, cont_color, cont_width, rectangular, x, y) ⇒ nil

    Returns:

    • (nil)
  • .plshade(z, x_range, y_range, clevel, fill_width, cont_color, cont_width, rectangular) ⇒ nil

    Returns:

    • (nil)
  • .plshade(z, x_range, y_range, clevel, fill_width, cont_color, cont_width, rectangular) {|x, y| ... } ⇒ nil

    Yields:

    • (x, y)

    Returns:

    • (nil)
  • .plshade(z, x_range, y_range, clevel, fill_width, cont_color, cont_width, rectangular, x, y) ⇒ nil

    Returns:

    • (nil)


1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
# File 'ext/rbplplot.c', line 1809

static VALUE
rb_plplot_plshade(int argc, VALUE *argv, VALUE mod)
{
  VALUE vz = Qnil;
  VALUE vxrng = Qnil;
  VALUE vyrng = Qnil;
  VALUE v3 = Qnil;
  VALUE v4 = Qnil;
  VALUE v5 = Qnil;
  VALUE v6 = Qnil;
  VALUE v7 = Qnil;
  VALUE v8 = Qnil;
  VALUE v9 = Qnil;
  VALUE v10 = Qnil;

  int do_shade1=0;
  PLfGrid gz;
  PLcGrid gt;
  PLFLT xmin, xmax, ymin, ymax;
  PLFLT shmin=0.0, shmax=0.0, shcolor=0.0;
  PLINT shcmap=0, shwidth=0, mincolor=0, maxcolor=0, minwidth=0, maxwidth=0, rectangular=0;
  VALUE vc;
  PLFLT *pc=NULL;
  PLINT nc=0, fillwidth=0, contcolor=0, contwidth=0;
  VALUE vtr0, vtr1;
  void (*pltr)(PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer);
  PLPointer pltr_data = &gt;

  rb_scan_args(argc, argv, "83",
      &vz, &vxrng, &vyrng, &v3, &v4, &v5, &v6, &v7, &v8, &v9, &v10);

  /* Validate parameter counts */
  if(argc == 9 || argc == 11) {
    /* plshade1 */
    do_shade1 = 1;
    if(argc == 11 && rb_block_given_p())
      rb_warning("unnecessary block given");
  } else {
    /* plshades */
    if(argc == 10 && rb_block_given_p())
      rb_warning("unnecessary block given");
  }

  /* Data conversion */
  vz = rb_plplot_fltary(vz); gz.f = NA_PTR_PLFLT(vz);
  if(NA_RANK(vz) != 2)
    rb_raise(rb_eArgError, "z must be two dimensional");
  gz.nx = gt.nx = NA_SHAPE1(vz);
  gz.ny = gt.ny = NA_SHAPE0(vz);
  rb_get_flt_pair(vxrng, &xmin, &xmax, 0.0, 1.0);
  rb_get_flt_pair(vyrng, &ymin, &ymax, 0.0, 1.0);

  if(do_shade1) {
    /* sh_range */
    rb_get_flt_pair(v3, &shmin, &shmax, 0.0, 0.0);
    /* sh_color (and sh_cmap implicitly) */
    shcolor = NUM2DBL(v4);
    if(TYPE(v4) == T_FLOAT && 0.0 <= shcolor && shcolor <= 1.0)
      shcmap = 1;
    /* sh_width */
    shwidth = NUM2INT(v5);
    /* cont_color */
    rb_get_int_pair(v6, &mincolor, &maxcolor, 0, 0);
    /* cont_width */
    rb_get_int_pair(v7, &minwidth, &maxwidth, 0, 0);
    /* rectangular */
    rectangular = PL_RTEST(v8);
    /* Setup for pltr proc */
    vtr0 = v9;
    vtr1 = v10;
  } else {
    /* clevel */
    vc = rb_plplot_fltary(v3); pc = NA_PTR_PLFLT(vc); nc = NA_TOTAL(vc);
    /* fill_width */
    fillwidth = NUM2INT(v4);
    /* cont_color */
    contcolor = NIL_P(v5) ? 0 : NUM2INT(v5);
    /* cont_width */
    contwidth = NIL_P(v6) ? 0 : NUM2INT(v6);
    /* rectangular */
    rectangular = PL_RTEST(v7);
    /* Setup for pltr proc */
    vtr0 = v8;
    vtr1 = v9;
  }

  rb_setup_pltr(vtr0, vtr1, &gt, &pltr);

  if(pltr == pltr0) {
    /*
     * pltr_data must be NULL to get plfsahdes to synthesize an identity
     * transform.
     */
    pltr_data = NULL;
  }

  if(do_shade1) {
    PLSYNC(plfshade1, PLF2OPS_NA, &gz, gz.nx, gz.ny, rb_defined_callback,
        xmin, xmax, ymin, ymax,
        shmin, shmax, shcmap, shcolor, shwidth,
        mincolor, minwidth, maxcolor, maxwidth,
        plfill, rectangular, pltr, pltr_data);
  } else {
    PLSYNC(plfshades, PLF2OPS_NA, &gz, gz.nx, gz.ny, rb_defined_callback,
        xmin, xmax, ymin, ymax,
        pc, nc, fillwidth, contcolor, contwidth,
        plfill, rectangular, pltr, pltr_data);
  }

  return Qnil;
}

.plslabelfunc(proc = nil) ⇒ nil .plslabelfunc {|axis, value| ... } ⇒ nil

This function allows a user to provide their own Proc (really any object responding to #call, e.g. Method) or block to provide custom axis label text. The Proc or block will be passed two parameters:

axis indicates for which axis a label is being requested. It will be one of PL::X_AXIS, PL::Y_AXIS, or PL::Z_AXIS.

value is the Float value along axis for which a label is being requested.

The value returned by the Proc or block will be used as the label text (after conversion to String, if needed). PLplot currently limits the length of returned label text to 39 characters (including escapes sequences).

Calling plslabelfunc with no block and no (or nil) parameter will restore the default labeling.

Overloads:

  • .plslabelfunc(proc = nil) ⇒ nil

    Returns:

    • (nil)
  • .plslabelfunc {|axis, value| ... } ⇒ nil

    Yields:

    • (axis, value)

    Returns:

    • (nil)


1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
# File 'ext/rbplplot.c', line 1955

static VALUE
rb_plplot_plslabelfunc(int argc, VALUE *argv, VALUE mod)
{
  VALUE vproc=Qnil, vblock=Qnil;
  void (*label_func)(PLINT axis, PLFLT value, char *label_text, void *label_data);

  label_func = NULL;

  rb_scan_args(argc, argv, "01&", &vproc, &vblock);

  if(!NIL_P(vproc) && !NIL_P(vblock))
    rb_warning("unnecessary block given");
  else if(NIL_P(vproc))
    vproc = vblock;

  /* If vproc is still nil */
  if(NIL_P(vproc))
    /* Reset default behavior */
    plslabelfunc(NULL, NULL);
  else {
    plslabelfunc(rb_labelfunc_callback, (void *)vproc);
  }

  return Qnil;
}

.plsmajnil

Set length of major ticks

Returns:

  • (nil)


3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
# File 'ext/rbplplot.c', line 3809

static VALUE
rb_mPLplot_plsmaj(VALUE obj,VALUE arg0,VALUE arg1)
{
  PLFLT ivar0;
  PLFLT ivar1;
  ivar0 = NUM2DBL(arg0);
  ivar1 = NUM2DBL(arg1);
  plsmaj(ivar0,ivar1);
  return Qnil;
}

.plsminnil

Set length of minor ticks

Returns:

  • (nil)


3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
# File 'ext/rbplplot.c', line 3826

static VALUE
rb_mPLplot_plsmin(VALUE obj,VALUE arg0,VALUE arg1)
{
  PLFLT ivar0;
  PLFLT ivar1;
  ivar0 = NUM2DBL(arg0);
  ivar1 = NUM2DBL(arg1);
  plsmin(ivar0,ivar1);
  return Qnil;
}

.plsori(irot90) ⇒ nil

Set orientation

Returns:

  • (nil)


3843
3844
3845
3846
3847
3848
3849
3850
# File 'ext/rbplplot.c', line 3843

static VALUE
rb_mPLplot_plsori(VALUE obj,VALUE arg0)
{
  PLINT ivar0;
  ivar0 = NUM2LONG(arg0);
  PLSYNC(plsori,ivar0);
  return Qnil;
}

.plspage(xp, yp, xleng, yleng, xoff, yoff) ⇒ nil

Set page parameters

Returns:

  • (nil)


3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
# File 'ext/rbplplot.c', line 3858

static VALUE
rb_mPLplot_plspage(VALUE obj,VALUE arg0,VALUE arg1,VALUE arg2,VALUE arg3,VALUE arg4,VALUE arg5)
{
  PLFLT ivar0;
  PLFLT ivar1;
  PLINT ivar2;
  PLINT ivar3;
  PLINT ivar4;
  PLINT ivar5;
  ivar0 = NUM2DBL(arg0);
  ivar1 = NUM2DBL(arg1);
  ivar2 = NUM2LONG(arg2);
  ivar3 = NUM2LONG(arg3);
  ivar4 = NUM2LONG(arg4);
  ivar5 = NUM2LONG(arg5);
  plspage(ivar0,ivar1,ivar2,ivar3,ivar4,ivar5);
  return Qnil;
}

.plspal0(filename) ⇒ nil

Set the palette for color map 0 using a cmap0*.pal format file.

Returns:

  • (nil)


3883
3884
3885
3886
3887
3888
3889
3890
# File 'ext/rbplplot.c', line 3883

static VALUE
rb_mPLplot_plspal0(VALUE obj,VALUE arg0)
{
  char * ivar0;
  arg0 = rb_obj_as_string(arg0); ivar0 = StringValuePtr(arg0);
  PLSYNC(plspal0,ivar0);
  return Qnil;
}

.plspal1(filename, interpolate) ⇒ nil

Set the palette for color map 1 using a cmap1*.pal format file.

Returns:

  • (nil)


3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
# File 'ext/rbplplot.c', line 3898

static VALUE
rb_mPLplot_plspal1(VALUE obj,VALUE arg0,VALUE arg1)
{
  char * ivar0;
  int ivar1;
  arg0 = rb_obj_as_string(arg0); ivar0 = StringValuePtr(arg0);
  ivar1 = PL_RTEST(arg1);
  PLSYNC(plspal1,ivar0,ivar1);
  return Qnil;
}

.plspause(bool) ⇒ nil

Set the pause (on end-of-page) status

Returns:

  • (nil)


3915
3916
3917
3918
3919
3920
3921
3922
# File 'ext/rbplplot.c', line 3915

static VALUE
rb_mPLplot_plspause(VALUE obj,VALUE arg0)
{
  int ivar0;
  ivar0 = PL_RTEST(arg0);
  plspause(ivar0);
  return Qnil;
}

.plsstrm(strm) ⇒ nil

Set current output stream

Returns:

  • (nil)


3930
3931
3932
3933
3934
3935
3936
3937
# File 'ext/rbplplot.c', line 3930

static VALUE
rb_mPLplot_plsstrm(VALUE obj,VALUE arg0)
{
  PLINT ivar0;
  ivar0 = NUM2LONG(arg0);
  plsstrm(ivar0);
  return Qnil;
}

.plssub(nx, ny) ⇒ nil

Set the number of subpages in x and y

Returns:

  • (nil)


3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
# File 'ext/rbplplot.c', line 3945

static VALUE
rb_mPLplot_plssub(VALUE obj,VALUE arg0,VALUE arg1)
{
  PLINT ivar0;
  PLINT ivar1;
  ivar0 = NUM2LONG(arg0);
  ivar1 = NUM2LONG(arg1);
  PLSYNC(plssub,ivar0,ivar1);
  return Qnil;
}

.plssymnil

Set symbol size

Returns:

  • (nil)


3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
# File 'ext/rbplplot.c', line 3962

static VALUE
rb_mPLplot_plssym(VALUE obj,VALUE arg0,VALUE arg1)
{
  PLFLT ivar0;
  PLFLT ivar1;
  ivar0 = NUM2DBL(arg0);
  ivar1 = NUM2DBL(arg1);
  plssym(ivar0,ivar1);
  return Qnil;
}

.plstartnil .plstart(dev) ⇒ nil .plstart(nx, ny) ⇒ nil .plstart(dev, nx, ny) ⇒ nil

Initialization. Note that plinit and plstar are aliases.

Overloads:

  • .plstartnil

    Returns:

    • (nil)
  • .plstart(dev) ⇒ nil

    Returns:

    • (nil)
  • .plstart(nx, ny) ⇒ nil

    Returns:

    • (nil)
  • .plstart(dev, nx, ny) ⇒ nil

    Returns:

    • (nil)


404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
# File 'ext/rbplplot.c', line 404

static VALUE
rb_plplot_plstart(int argc, VALUE *argv, VALUE mod)
{
  char *dev;
  int nx, ny;

  switch(argc) {
    case 0:
      plinit();
      break;
    case 1:
      argv[0] = rb_obj_as_string(argv[0]);
      dev = StringValuePtr(argv[0]);
      plstart(dev, 1, 1);
      break;
    case 2:
      nx = NUM2INT(argv[0]);
      ny = NUM2INT(argv[1]);
      plstar(nx, ny);
      break;
    case 3:
      argv[0] = rb_obj_as_string(argv[0]);
      dev = StringValuePtr(argv[0]);
      nx = NUM2INT(argv[1]);
      ny = NUM2INT(argv[2]);
      plstart(dev, nx, ny);
      break;
    default:
      rb_raise(rb_eArgError, "wrong number of arguments (%d for %d)",
          argc, argc < 1 ? 1 : 3);
  }

  return Qnil;
}

.plstylnil .plstyl(mark, space) ⇒ nil

Set line style

Calling plstyl with no arguments returns the line style to the default continuous line style.

Overloads:

  • .plstylnil

    Returns:

    • (nil)
  • .plstyl(mark, space) ⇒ nil

    Returns:

    • (nil)


1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
# File 'ext/rbplplot.c', line 1991

static VALUE
rb_plplot_plstyl(int argc, VALUE *argv, VALUE mod)
{
  VALUE vmark, vspace;
  PLINT m1, s1;
  PLINT *pm, *ps;
  unsigned int size;

  if(argc == 0) {
    m1 = 0; pm = &m1;
    s1 = 0; ps = &s1;
    plstyl(0, pm, ps);
    return Qnil;
  }

  rb_scan_args(argc, argv, "20", &vmark, &vspace);

  if(rb_obj_is_kind_of(vmark, rb_cNumeric)) {
    m1 = NUM2INT(vmark); pm = &m1;
    s1 = NUM2INT(vspace); ps = &s1;
    size = 1;
  } else {
    vmark = rb_plplot_intary(vmark); pm = NA_PTR_PLINT(vmark);
    vspace = rb_plplot_intary(vspace); ps = NA_PTR_PLINT(vspace);
    size = min(NA_TOTAL(vmark), NA_TOTAL(vspace));
  }

  plstyl(size, pm, ps);

  return Qnil;
}

.plsurf3d(x, y, z, opt = nil, clevel = nil) ⇒ nil

Plot shaded 3-d surface plot

Returns:

  • (nil)


2029
2030
2031
2032
2033
2034
# File 'ext/rbplplot.c', line 2029

static VALUE
rb_plplot_plsurf3d(int argc, VALUE *argv, VALUE mod)
{
  plplot_pl3d(argc, argv, 's');
  return Qnil;
}

.plsvect(arrowx, arrowy, fill) ⇒ nil

Set arrow style for vector plots. See #plvect.

Returns:

  • (nil)


2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
# File 'ext/rbplplot.c', line 2042

static VALUE
rb_plplot_plsvect(VALUE mod, VALUE vx, VALUE vy, VALUE vfill)
{
  PLFLT x1, y1;
  PLFLT *px, *py;
  int size;
  PLINT fill;

  /*
   * Allow a "single point" arrow?  PLplot library doesn't prohibit it, so this
   * shouldn't either.
   */
  if(rb_obj_is_kind_of(vx, rb_cNumeric)) {
    x1 = NUM2DBL(vx); px = &x1;
    y1 = NUM2DBL(vy); py = &y1;
    size = 1;
  } else {
    vx = rb_plplot_fltary(vx); px = NA_PTR_PLFLT(vx);
    vy = rb_plplot_fltary(vy); py = NA_PTR_PLFLT(vy);
    size = min(NA_TOTAL(vx), NA_TOTAL(vy));
  }

  fill = PL_RTEST(vfill);

  plsvect(px, py, size, fill);

  return Qnil;
}

.plsvpa(xmin, xmax, ymin, ymax) ⇒ nil

Specify viewport in absolute coordinates

Returns:

  • (nil)


3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
# File 'ext/rbplplot.c', line 3979

static VALUE
rb_mPLplot_plsvpa(VALUE obj,VALUE arg0,VALUE arg1,VALUE arg2,VALUE arg3)
{
  PLFLT ivar0;
  PLFLT ivar1;
  PLFLT ivar2;
  PLFLT ivar3;
  ivar0 = NUM2DBL(arg0);
  ivar1 = NUM2DBL(arg1);
  ivar2 = NUM2DBL(arg2);
  ivar3 = NUM2DBL(arg3);
  PLSYNC(plsvpa,ivar0,ivar1,ivar2,ivar3);
  return Qnil;
}

.plsxax(digmax, digits) ⇒ nil

Set x axis parameters

Returns:

  • (nil)


4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
# File 'ext/rbplplot.c', line 4000

static VALUE
rb_mPLplot_plsxax(VALUE obj,VALUE arg0,VALUE arg1)
{
  PLINT ivar0;
  PLINT ivar1;
  ivar0 = NUM2LONG(arg0);
  ivar1 = NUM2LONG(arg1);
  plsxax(ivar0,ivar1);
  return Qnil;
}

.plsyax(digmax, digits) ⇒ nil

Set y axis parameters

Returns:

  • (nil)


4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
# File 'ext/rbplplot.c', line 4017

static VALUE
rb_mPLplot_plsyax(VALUE obj,VALUE arg0,VALUE arg1)
{
  PLINT ivar0;
  PLINT ivar1;
  ivar0 = NUM2LONG(arg0);
  ivar1 = NUM2LONG(arg1);
  plsyax(ivar0,ivar1);
  return Qnil;
}

.plsym(x, y, sym = 9) ⇒ nil

Plots a symbol at the specified points

Returns:

  • (nil)


2077
2078
2079
2080
2081
2082
# File 'ext/rbplplot.c', line 2077

static VALUE
rb_plplot_plsym(int argc, VALUE *argv, VALUE mod)
{
  plplot_plpoinsym(argc, argv, 's');
  return Qnil;
}

.plszax(digmax, digits) ⇒ nil

Set z axis parameters

Returns:

  • (nil)


4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
# File 'ext/rbplplot.c', line 4034

static VALUE
rb_mPLplot_plszax(VALUE obj,VALUE arg0,VALUE arg1)
{
  PLINT ivar0;
  PLINT ivar1;
  ivar0 = NUM2LONG(arg0);
  ivar1 = NUM2LONG(arg1);
  plszax(ivar0,ivar1);
  return Qnil;
}

.pltextnil

Switch to text screen

Returns:

  • (nil)


4051
4052
4053
4054
4055
4056
4057
4058
# File 'ext/rbplplot.c', line 4051

static VALUE
rb_mPLplot_pltext(VALUE obj)
{
  
  
  PLSYNC(pltext,);
  return Qnil;
}

.pltimefmt(fmt) ⇒ nil

Set format for date / time labels

Returns:

  • (nil)


4066
4067
4068
4069
4070
4071
4072
4073
# File 'ext/rbplplot.c', line 4066

static VALUE
rb_mPLplot_pltimefmt(VALUE obj,VALUE arg0)
{
  char * ivar0;
  arg0 = rb_obj_as_string(arg0); ivar0 = StringValuePtr(arg0);
  pltimefmt(ivar0);
  return Qnil;
}

.plvasp(aspect) ⇒ nil

Specify viewport using aspect ratio only

Returns:

  • (nil)


4081
4082
4083
4084
4085
4086
4087
4088
# File 'ext/rbplplot.c', line 4081

static VALUE
rb_mPLplot_plvasp(VALUE obj,VALUE arg0)
{
  PLFLT ivar0;
  ivar0 = NUM2DBL(arg0);
  PLSYNC(plvasp,ivar0);
  return Qnil;
}

.plvect(u, v, scale = nil) ⇒ nil .plvect(u, v, scale = nil) {|x, y| ... } ⇒ nil .plvect(u, v, x, y, scale = nil) ⇒ nil

Vector plot

First form (two or three arguments with no block) uses PLplot’s pltr0 identity transform.

Second form (two or three arguments with a block) uses the provided block to perform the coordinate transform.

Third form (four or five arguments with no block) uses PLplot’s pltr1 transform if x and y are one dimensional or PLplot’s pltr2p transform if x or y are two dimensional.

Overloads:

  • .plvect(u, v, scale = nil) ⇒ nil

    Returns:

    • (nil)
  • .plvect(u, v, scale = nil) {|x, y| ... } ⇒ nil

    Yields:

    • (x, y)

    Returns:

    • (nil)
  • .plvect(u, v, x, y, scale = nil) ⇒ nil

    Returns:

    • (nil)


2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
# File 'ext/rbplplot.c', line 2102

static VALUE
rb_plplot_plvect(int argc, VALUE *argv, VALUE mod)
{
  VALUE vu, vv, v0=Qnil, v1=Qnil, v2=Qnil;
  PLINT nx, ny;
  PLfGrid gu, gv;
  PLFLT scale = 0.0;
  void (*pltr)(PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer);
  PLcGrid gt;

  rb_scan_args(argc, argv, "23", &vu, &vv, &v0, &v1, &v2);

  vu = rb_plplot_fltary(vu); gu.f = NA_PTR_PLFLT(vu);
  vv = rb_plplot_fltary(vv); gv.f = NA_PTR_PLFLT(vv);
  if(NA_RANK(vu) != 2)
    rb_raise(rb_eArgError, "u must be two dimensional");
  if(NA_RANK(vv) != 2)
    rb_raise(rb_eArgError, "v must be two dimensional");
  if(NA_SHAPE1(vu) != NA_SHAPE1(vv) || NA_SHAPE0(vu) != NA_SHAPE0(vv))
    rb_raise(rb_eArgError, "u and v must have same dimensions");
  nx = gt.nx = gu.nx = gv.nx = NA_SHAPE1(vu);
  ny = gt.ny = gu.ny = gv.ny = NA_SHAPE0(vu);
  pltr = NULL;

  if(argc < 4) {
    pltr = rb_block_given_p() ? rb_pltr : pltr0;
    if(!NIL_P(v0))
      scale = NUM2DBL(v0);
  } else {
    /* Warn if block is given */
    if(rb_block_given_p())
      rb_warning("unnecessary block given");

    rb_setup_pltr(v0, v1, &gt, &pltr);

    if(!NIL_P(v2))
      scale = NUM2DBL(v2);
  }

  PLSYNC(plfvect, plf2eval, &gu, &gv, nx, ny, scale, pltr, &gt);

  return Qnil;
}

.plvpas(xmin, xmax, ymin, ymax, aspect) ⇒ nil

Specify viewport using coordinates and aspect ratio

Returns:

  • (nil)


4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
# File 'ext/rbplplot.c', line 4096

static VALUE
rb_mPLplot_plvpas(VALUE obj,VALUE arg0,VALUE arg1,VALUE arg2,VALUE arg3,VALUE arg4)
{
  PLFLT ivar0;
  PLFLT ivar1;
  PLFLT ivar2;
  PLFLT ivar3;
  PLFLT ivar4;
  ivar0 = NUM2DBL(arg0);
  ivar1 = NUM2DBL(arg1);
  ivar2 = NUM2DBL(arg2);
  ivar3 = NUM2DBL(arg3);
  ivar4 = NUM2DBL(arg4);
  PLSYNC(plvpas,ivar0,ivar1,ivar2,ivar3,ivar4);
  return Qnil;
}

.plvpor(xmin, xmax, ymin, ymax) ⇒ nil

Specify viewport using coordinates

Returns:

  • (nil)


4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
# File 'ext/rbplplot.c', line 4119

static VALUE
rb_mPLplot_plvpor(VALUE obj,VALUE arg0,VALUE arg1,VALUE arg2,VALUE arg3)
{
  PLFLT ivar0;
  PLFLT ivar1;
  PLFLT ivar2;
  PLFLT ivar3;
  ivar0 = NUM2DBL(arg0);
  ivar1 = NUM2DBL(arg1);
  ivar2 = NUM2DBL(arg2);
  ivar3 = NUM2DBL(arg3);
  PLSYNC(plvpor,ivar0,ivar1,ivar2,ivar3);
  return Qnil;
}

.plvstanil

Select standard viewport

Returns:

  • (nil)


4140
4141
4142
4143
4144
4145
4146
4147
# File 'ext/rbplplot.c', line 4140

static VALUE
rb_mPLplot_plvsta(VALUE obj)
{
  
  
  PLSYNC(plvsta,);
  return Qnil;
}

.plw3d(basex, basey, height, xmin, xmax, ymin, ymax, zmin, zmax, alt, az) ⇒ nil

Set up window for 3-d plotting

Returns:

  • (nil)


4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
# File 'ext/rbplplot.c', line 4155

static VALUE
rb_mPLplot_plw3d(VALUE obj,VALUE arg0,VALUE arg1,VALUE arg2,VALUE arg3,VALUE arg4,VALUE arg5,VALUE arg6,VALUE arg7,VALUE arg8,VALUE arg9,VALUE arg10)
{
  PLFLT ivar0;
  PLFLT ivar1;
  PLFLT ivar2;
  PLFLT ivar3;
  PLFLT ivar4;
  PLFLT ivar5;
  PLFLT ivar6;
  PLFLT ivar7;
  PLFLT ivar8;
  PLFLT ivar9;
  PLFLT ivar10;
  ivar0 = NUM2DBL(arg0);
  ivar1 = NUM2DBL(arg1);
  ivar2 = NUM2DBL(arg2);
  ivar3 = NUM2DBL(arg3);
  ivar4 = NUM2DBL(arg4);
  ivar5 = NUM2DBL(arg5);
  ivar6 = NUM2DBL(arg6);
  ivar7 = NUM2DBL(arg7);
  ivar8 = NUM2DBL(arg8);
  ivar9 = NUM2DBL(arg9);
  ivar10 = NUM2DBL(arg10);
  PLSYNC(plw3d,ivar0,ivar1,ivar2,ivar3,ivar4,ivar5,ivar6,ivar7,ivar8,ivar9,ivar10);
  return Qnil;
}

.plwid(width) ⇒ nil

Set pen width

Returns:

  • (nil)


4190
4191
4192
4193
4194
4195
4196
4197
# File 'ext/rbplplot.c', line 4190

static VALUE
rb_mPLplot_plwid(VALUE obj,VALUE arg0)
{
  PLINT ivar0;
  ivar0 = NUM2LONG(arg0);
  plwid(ivar0);
  return Qnil;
}

.plwind(xmin, xmax, ymin, ymax) ⇒ nil

Specify world coordinates of viewport boundaries

Returns:

  • (nil)


4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
# File 'ext/rbplplot.c', line 4205

static VALUE
rb_mPLplot_plwind(VALUE obj,VALUE arg0,VALUE arg1,VALUE arg2,VALUE arg3)
{
  PLFLT ivar0;
  PLFLT ivar1;
  PLFLT ivar2;
  PLFLT ivar3;
  ivar0 = NUM2DBL(arg0);
  ivar1 = NUM2DBL(arg1);
  ivar2 = NUM2DBL(arg2);
  ivar3 = NUM2DBL(arg3);
  PLSYNC(plwind,ivar0,ivar1,ivar2,ivar3);
  return Qnil;
}

.plxormod(mode) ⇒ Object

Enter or leave xor mode



4226
4227
4228
4229
4230
4231
4232
4233
4234
# File 'ext/rbplplot.c', line 4226

static VALUE
rb_mPLplot_plxormod(VALUE obj,VALUE arg0)
{
  int ivar0;
  int ovar0;
  ivar0 = PL_RTEST(arg0);
  plxormod(ivar0,&ovar0);
  return (ovar0 ? Qtrue : Qfalse);
}

.program_nameString

Returns PLplot’s internal notion of program name. PLplot uses this String for various things (e.g. window titles).

Note that this is a singleton method and cannot be “included”.

Returns:

  • (String)


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

static VALUE
rb_plplot_program_name(VALUE mod)
{
  return rb_plplot_program_name_value;
}

.program_name=(string) ⇒ Object

Sets PLplot’s internal notion of program name. PLplot uses this String for various things (e.g. window titles).

Note that this is a singleton method and cannot be “included”.



345
346
347
348
349
350
351
352
353
354
355
356
357
# File 'ext/rbplplot.c', line 345

static VALUE
rb_plplot_program_name_equals(VALUE mod, VALUE vprogname)
{
  int plargc=1;
  char *plargv[2];

  rb_plplot_program_name_value = rb_obj_as_string(vprogname);
  plargv[0] = StringValuePtr(rb_plplot_program_name_value);
  plargv[1] = NULL;
  plparseopts(&plargc, (const char **)plargv, PL_PARSE_NODELETE | PL_PARSE_QUIET);

  return Qnil;
}

.syncBoolean

Returns state of Ruby’s PLplot sync flag.

Note that this is a singleton method and cannot be “included”.

Returns:

  • (Boolean)


367
368
369
370
371
# File 'ext/rbplplot.c', line 367

static VALUE
rb_plplot_sync(VALUE mod)
{
  return rb_plplot_sync_flag ? Qtrue : Qfalse;
}

.sync=(true_or_false) ⇒ Object

Sets state of Ruby’s PLplot sync flag.

Note that this is a singleton method and cannot be “included”.



381
382
383
384
385
386
387
388
389
390
391
392
393
# File 'ext/rbplplot.c', line 381

static VALUE
rb_plplot_sync_equals(VALUE mod, VALUE vstate)
{
  int state = RTEST(vstate);

  /* If turning on, flush */
  if(!rb_plplot_sync_flag && state)
    plflush();

  rb_plplot_sync_flag = state;

  return Qnil;
}