gr-crystal

Crystal API for GR framework

gr-crystal

Crystal binding for GR framework

A (still incomplete) interface to GR framework from Crystal

Installation

  1. You need to install GR in the standard way and set the enviromental variable GRDIR point to the installed directory.

  2. Add the dependency to your shard.yml:

    dependencies:
      grlib:
        github: jmakino/gr-crystal
    
  3. Run shards install

Getting started

At your project directory (where you ran shards install), try

crystal lib/grlib/examples/grsample.cr

should show a simple plot.

  • GRDIR env variable should point to the directory where you placed gr files. In particular, lib and fonts directories should be there
  • GKS_WSTYPE env variable should be set. For X11, its value should be "x11".

Usage

Essentially the same as that for C binging. Difference:

  • All size+pointer arguments to C array are replaced by Crystal arrays.

  • C char* is replaced by Crysral Sring

Example of API

void gr_polyline(int, double *, double *)

is called as

GR.polyline(Array(Float64), Array(Float64))

Examples

polyline plot

polyline sample output

contour plot

contour sample output

3d contour plot

contour sample output

3d animation

3d animation sample output

log-log plot

log-log plot sample output

semilog plot

semilog plot sample output

Todo

All source and documents should be generated automatically...

Repository

gr-crystal

Owner
Statistic
  • 7
  • 1
  • 0
  • 4
  • 0
  • over 1 year ago
  • January 26, 2020
License

MIT License

Links
Synced at

Sun, 12 May 2024 16:42:05 GMT

Languages