• Stars
    star
    91
  • Rank 352,827 (Top 8 %)
  • Language
    Ruby
  • License
    Other
  • Created over 4 years ago
  • Updated 3 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Ruby wrapper for the GR framework

GR.rb

Gem Version CI Gitter Chat Docs Latest

rdatasets-1 stem histogram barplot scatter3 volume griddata 2darray 2dpolararray hexbin rdatasets-2 rdatasets-3 surface face shade

📊 GR framework - powerful visualization library - for Ruby

Installation

First, install GR. Then install gr-plot gem.

gem install gr-plot

pkg-config will detect the location of the shared library. Otherwise, you need to specify the environment variable.

export GRDIR="/your/path/to/gr"

Quick Start

👉 Wiki -plotting functions

require 'gr/plot'

x = [0, 0.2, 0.4, 0.6, 0.8, 1.0]
y = [0.3, 0.5, 0.4, 0.2, 0.6, 0.7]

# show the figure
GR.plot(x, y)

# Save the figure in PNG format.
GR.savefig("figure.png")

GR.rb supports Jupyter Notebook / Lab.

API Overview

require 'gr/plot'
GR.plot(x, y)

List of available functions.

plot step plot3 polar scatter scatter3 stem barplot histogram polarhistogram hexbin contour contourf tricont surface trisurf wireframe volume heatmap polarheatmap shade imshow isosurface

See GR.rb Wiki for details. Some GR module methods are overwritten. Code has been moved to gr-plot.

GR - A module for calling native GR functions

2-D Plots and common 3-D Plots.

require 'gr'

# For example
GR.setviewport(0.1, 0.9, 0.1, 0.9)
GR.setwindow(0.0, 20.0, 0.0, 20.0)

GR3 - A module for calling native GR3 functions

Complex 3D scenes.

require 'gr3'

# For example
GR3.cameralookat(-3, 2, -2, 0, 0, 0, 0, 0, -1)

Using GR.rb non-interactively

Both APIs will by default start a Qt based window to show the result of the last call. This behavior is caused by GR itself as it will implicitly generate output to a file or application. If you want to use GR.rb non-interactively, eg., as part of a static site build, you can do this by setting the environment variable GKS_WSTYPEto 100.

export GKS_WSTYPE=100

Documentation

GR Installation

Installing an official release (recommended)

Download the latest release and place it where you want. Then set environment variable GRDIR.

export GRDIR="your/path/to/gr"

macOS : See "How to open apps from un-notarized or unidentified developers" in the Apple documentation.

Using package managers

The third party GR packages for Mac, Linux and Windows are available for advanced users. However, these packages are provided by OSS volunteers and may not be the latest version or support some features (such as video output). If you find any problem, please report the issue here.

Mac - Homebrew

brew install libgr
export GKS_WSTYPE=411 # Set the workstation type to gksqt (recommended)

Linux - openSUSE Build service

GR releases are also available from the openSUSE Build service for CentOS, Debian, Fedora openSUSE and Ubuntu. Obtain a packaged release here.

GR will be installed in /usr/gr. Set one of the following environment variables so that GR.rb can find the library.

export GRDIR="/usr/gr" # Check the location with `dpkg -L gr`
export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/usr/gr/lib/pkgconfig"

Windows - MSYS2

If you are using Rubyinstaller, pacman will automatically install mingw-w64-gr when the gem is installed.

Contributing

GR.rb is a library under development, so even small improvements like fixing typos are welcome! Please feel free to send us your PR.

  • Report bugs
  • Fix bugs and submit pull requests
  • Write, clarify, or fix documentation
  • Suggest or add new features
  • Update GR packages ( Homebrew, MinGW, red-data-tools )
  • Create visualization tools based on GR.rb

If you are not familiar with Ruby gem development, please see I'm new to Ruby

Do you need commit rights to my repository?
Do you want to get admin rights and take over the project?
If so, please feel free to contact us.

I've seen a lot of OSS abandoned because no one has commit rights to the original repository anymore; the right to request commit rights for GR.rb is always open.

Acknowledgements

We would like to thank Josef Heinen, the creator of GR and GR.jl, Florian Rhiem, the creator of python-gr, and all GR developers.

More Repositories

1

YouPlot

A command line tool that draw plots on the terminal.
Ruby
3,885
star
2

unicode_plot.rb

Plot your data by Unicode characters
Ruby
245
star
3

charty

Visualizing your data in Ruby
Ruby
190
star
4

jekyll-jupyter-notebook

Jekyll Jupyter Notebook plugin
Ruby
159
star
5

red-chainer

A flexible framework for neural network for Ruby
Ruby
103
star
6

red_amber

A dataframe library for Rubyists.
Ruby
59
star
7

red-arrow

Ruby bindings for Apache Arrow based on GObject Introspection
Ruby
52
star
8

red-datasets

A RubyGem that provides common datasets
Ruby
30
star
9

extpp

C++ Ruby extension API
C++
20
star
10

packages.red-data-tools.org

The source of packages.red-data-tools.org
Ruby
13
star
11

red-arrow-duckdb

A library that provides Apache Arrow support to ruby-duckdb
C++
10
star
12

parquet-glib

GLib wrapper library of Apache Parquet
C++
9
star
13

red-parquet

Ruby bindings for Apache Parquet based on GObject Introspection
Ruby
7
star
14

red-opencv

Ruby bindings for OpenCL based on GObject Introspection
Ruby
6
star
15

red-optuna

Ruby bindings for Optuna, a hyperparameter optimization framework
Ruby
5
star
16

activerecord-duckdb-adapter

Ruby
5
star
17

red-datasets-arrow

A Red Datasets plugin to export dataset as Apache Arrow object
Ruby
5
star
18

red-arrow-activerecord

A library that provides conversion method between Apache Arrow and Active Record
Ruby
5
star
19

red-colors

Color features for Ruby
Ruby
4
star
20

red-arrow-nmatrix

A library that provides conversion method between Apache Arrow and NMatrix
Ruby
3
star
21

xtensor-arrow-glib

GLib wrapper library of xtensor for Apache Arrow
C++
3
star
22

opencv-glib

GLib bindings for OpenCV
C++
3
star
23

red-arrow-numo-narray

A library that provides conversion method between Apache Arrow and Numo::NArray
Ruby
3
star
24

red-table-query

Universal query interface for table data
Ruby
3
star
25

activerecord-adbc-adapter

ADBC based Active Record adapter
Ruby
3
star
26

red-datasets-numo-narray

A Red Datasets plugin to export dataset as Numo::NArray object
Ruby
3
star
27

red-arrow-pycall

A library that provides conversion method between Apache Arrow and PyCall
Ruby
3
star
28

dlib-glib

GLib bindings for Dlib
C++
2
star
29

fluent-plugin-s3-arrow

Extends the fluent-plugin-s3 compression algorithm to enable red-arrow compression.
Ruby
2
star
30

red-datasets-parquet

A Red Datasets plugin to process datasets provided as Apache Parquet format
Ruby
2
star
31

red-datasets-gdk-pixbuf

A Red Datasets plugin to export dataset as GdkPixbuf::Pixbuf object
Ruby
2
star
32

red-float

Float32 and Float16 for Ruby
C
1
star
33

red-arrow-gsl

A library that provides conversion method between Apache Arrow and Ruby/GSL
Ruby
1
star
34

charty-backends-jfreechart

Charty JFreeChart backend adapter
Ruby
1
star
35

red-datasets-daru

A Red Datasets plugin to export dataset as Daru::DataFrame object
Ruby
1
star
36

gr-plot

A simple, matlab-style API for GR.rb
Ruby
1
star
37

events

Repository for Red Data Tools related events
1
star
38

red-data-tools.github.io

The Red Data Tools project site
SCSS
1
star
39

red-data-reader

Ruby library to read data
Ruby
1
star
40

red-arrow-gpu

Ruby bindings for Apache Arrow GPU based on GObject Introspection
Ruby
1
star
41

activerecord-arrow-adapters

Connection adapters using Apache Arrow internally
Ruby
1
star