Skip to content

Commit 7c2a7b0

Browse files
committed
Add examples
1 parent c71c849 commit 7c2a7b0

File tree

2 files changed

+34
-3
lines changed

2 files changed

+34
-3
lines changed

lib/matplotlib/axis.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ class XTick
66

77
class YTick
88
include PyCall::PyObjectWrapper
9-
wrap_class PyCall.import_module('matplotlib.axis').XTick
9+
wrap_class PyCall.import_module('matplotlib.axis').YTick
1010
end
1111

1212
class XAxis
@@ -16,6 +16,6 @@ class XAxis
1616

1717
class YAxis
1818
include PyCall::PyObjectWrapper
19-
wrap_class PyCall.import_module('matplotlib.axis').XAxis
19+
wrap_class PyCall.import_module('matplotlib.axis').YAxis
2020
end
2121
end

spec/matplotlib_spec.rb

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,38 @@
11
require "spec_helper"
22

3-
describe Matplotlib do
3+
RSpec.describe Matplotlib do
44
it "has a version number" do
55
expect(Matplotlib::VERSION).not_to be nil
66
end
7+
8+
describe Matplotlib::XAxis do
9+
specify do
10+
fig = Matplotlib::Pyplot.figure
11+
ax = fig.add_axes(PyCall.tuple(0.1, 0.2, 0.8, 0.7))
12+
expect(ax.xaxis).to be_a(Matplotlib::XAxis)
13+
end
14+
end
15+
16+
describe Matplotlib::YAxis do
17+
specify do
18+
fig = Matplotlib::Pyplot.figure
19+
ax = fig.add_axes(PyCall.tuple(0.1, 0.2, 0.8, 0.7))
20+
expect(ax.yaxis).to be_a(Matplotlib::YAxis)
21+
end
22+
end
23+
24+
describe Matplotlib::Spine do
25+
specify do
26+
fig = Matplotlib::Pyplot.figure
27+
ax = fig.add_axes(PyCall.tuple(0.1, 0.2, 0.8, 0.7))
28+
expect(ax.spines['right']).to be_a(Matplotlib::Spine)
29+
end
30+
end
31+
32+
describe Matplotlib::PolarAxes do
33+
specify do
34+
ax = Matplotlib::Pyplot.subplot(111, projection: :polar)
35+
expect(ax).to be_a(Matplotlib::PolarAxes)
36+
end
37+
end
738
end

0 commit comments

Comments
 (0)