Skip to content
kojix2 edited this page Jun 16, 2020 · 5 revisions

Mutiple line plots

x = Numo::DFloat.linspace(0, 10, 1001)
y1 = Numo::NMath.sin(x)
y2 = Numo::NMath.cos(x)
GR.plot([x, y1], [x, y2])

x = Numo::DFloat.linspace(0, 10, 101)
y1 = Numo::NMath.sin(x)
y2 = Numo::NMath.cos(x)
GR.plot([x, y1, spec: 'o'], [x, y2, spec: 'g+'])

GR.plot(
  [x, y1, 'go'], [x, y2, 'r*'],
  title:    "Multiple plot example",
  xlabel:   "x",
  ylabel:   "y",
  ylim:     [-1.2, 1.2],
  labels:   ["sin(x)", "cos(x)"],
  location: 11,
  figsize:  [8,4]
)

known issue

https://github.com/red-data-tools/GR.rb/issues/27