-
Notifications
You must be signed in to change notification settings - Fork 7
Multiple subplots
kojix2 edited this page Jun 17, 2020
·
15 revisions
You can use the subplot
method.
require 'gr/plot'
x = [1,2,3,4,5,6,7,8,9,10]
y = x.shuffle
GR.barplot x, y, GR.subplot(2, 2, 1)
GR.stem x, y, GR.subplot(2, 2, 2)
GR.step x, y, GR.subplot(2, 2, 3)
GR.plot x, y, GR.subplot(2, 2, 4)
subplot
returns a simple hash like this. Why does the GR.rb subplot simply return a Hash, unlike GR.jl? This is because the position of the subplot is better when it can be fine-tuned by a human being. Tweak the position of the subplot by changing the numbers in the Hash.
GR.subplot(2,2,1)
=> {:subplot=>[0.0, 0.5, 0.5, 1.0], :clear=>true, :update=>false}
User's Guide
Simple, matlab-style API
- Plotting functions
- Plot attributes
- Multiple plots
- Multiple subplots
- Save Plot to a file
- Jupyter Notebook
GR Native functions
For developers