Skip to content

Commit f781310

Browse files
committed
remove abs_y* variables from XAxis class
1 parent 0f10a6f commit f781310

4 files changed

Lines changed: 6 additions & 8 deletions

File tree

lib/rubyplot/artist/axes.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ def assign_x_ticks
216216
Rubyplot::Artist::XTick.new(
217217
self,
218218
abs_x: i * inter_ticks_distance + @x_axis.abs_x1,
219-
abs_y: @x_axis.abs_y1,
219+
abs_y: @origin[1],
220220
label: tick_label,
221221
length: 6,
222222
label_distance: 10

lib/rubyplot/artist/axis/x_axis.rb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@ class XAxis < Axis::Base
66
def initialize axes
77
super
88
@abs_x1 = @axes.origin[0]
9-
@abs_y1 = @axes.origin[1]
109
@abs_x2 = @axes.abs_x + @axes.width - @axes.y_axis_margin
11-
@abs_y2 = @axes.origin[1]
1210
@major_ticks_distance = (@abs_x2 - @abs_x1) / @major_ticks_count
1311
@length = (@abs_x2 - @abs_x1).abs
1412
configure_axis_line
@@ -24,7 +22,7 @@ def draw
2422

2523
def configure_axis_line
2624
@line = Rubyplot::Artist::Line2D.new(
27-
self, abs_x1: @abs_x1, abs_y1: @abs_y1, abs_x2: @abs_x2, abs_y2: @abs_y2,
25+
self, abs_x1: @abs_x1, abs_y1: @axes.origin[1], abs_x2: @abs_x2, abs_y2: @axes.origin[1],
2826
stroke_width: @stroke_width)
2927
end
3028

lib/rubyplot/artist/plot/multi_bars.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def configure_x_ticks
5555
Rubyplot::Artist::XTick.new(
5656
@axes,
5757
abs_x: @axes.abs_x + @axes.y_axis_margin + i * @max_slot_width + @max_slot_width / 2,
58-
abs_y: @axes.x_axis.abs_y1,
58+
abs_y: @axes.origin[1],
5959
label: label,
6060
length: 6,
6161
label_distance: 10
@@ -68,7 +68,7 @@ def set_bar_dims bar_plot, index
6868
@num_max_slots.times do |i|
6969
bar_plot.abs_x_left[i] = @axes.abs_x + @axes.y_axis_margin +
7070
i * @max_slot_width + @padding / 2 + index * bar_plot.bar_width
71-
bar_plot.abs_y_left[i] = @axes.x_axis.abs_y1 - @axes.x_axis.stroke_width
71+
bar_plot.abs_y_left[i] = @axes.origin[1] - @axes.x_axis.stroke_width
7272
end
7373
end
7474
end # class MultiBars

spec/axes_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@
171171
FileUtils.mkdir_p @temp_dir
172172
end
173173

174-
it "plots a single bubble plot" do
174+
it "plots a single bubble plot", focus: true do
175175
fig = Rubyplot::Figure.new
176176
axes = fig.add_subplot 0,0
177177
axes.bubble! do |p|
@@ -532,7 +532,7 @@
532532
p.label = name
533533
end
534534
end
535-
535+
536536
file = "/#{Rubyplot.backend}_wide_multiple_bars.png"
537537
fig.write(@temp_dir + file)
538538

0 commit comments

Comments
 (0)