Skip to content

Commit ccaa274

Browse files
committed
remove text aliasing
1 parent 21ea19a commit ccaa274

File tree

6 files changed

+12
-13
lines changed

6 files changed

+12
-13
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ Deadline: 15 January 2019
1818
## Release v0.1.rc2
1919
Deadline: 26 February 2019
2020

21+
* Integrate GR backend into existing API.
2122
* Support multiple Axes on the same Figure.
2223
* Support atleast 3 new kinds of plots.
2324

lib/rubyplot.rb

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,8 @@
1515
require 'rubyplot/gr_wrapper'
1616

1717
module Rubyplot
18+
@@backend = Rubyplot::Backend::MagickWrapper.new
1819
def self.backend
19-
b = ENV['RUBYPLOT_BACKEND']
20-
return b.to_sym if %w[magick].include?(b)
21-
22-
:magick
20+
@@backend
2321
end
2422
end

lib/rubyplot/artist/figure.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ def add_subplots(nrows, ncols)
5555

5656
def add_subplot(nrow, ncol)
5757
@subplots[nrow][ncol] = Rubyplot::Artist::Axes.new(self)
58+
@subplots[nrow][ncol]
5859
end
5960

6061
# Draw on a canvas and output to a file.

lib/rubyplot/artist/plot/multi_bars.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ def initialize(*args, bar_plots:)
1818
@y_min = @bar_plots.map(&:y_min).min
1919
@x_max = @bar_plots.map(&:x_max).max
2020
@y_max = @bar_plots.map(&:y_max).max
21-
configure_plot_geometry_data
22-
configure_x_ticks
21+
configure_plot_geometry_data!
22+
configure_x_ticks!
2323
end
2424

2525
def normalize
@@ -32,7 +32,7 @@ def draw
3232

3333
private
3434

35-
def configure_plot_geometry_data
35+
def configure_plot_geometry_data!
3636
@num_max_slots = @bar_plots.map(&:num_bars).max
3737
@max_slot_width = (@axes.x_axis.abs_x2 - @axes.x_axis.abs_x1).abs / @num_max_slots
3838
# FIXME: figure out a way to specify inter-box space somehow.
@@ -45,7 +45,7 @@ def configure_plot_geometry_data
4545
end
4646
end
4747

48-
def configure_x_ticks
48+
def configure_x_ticks!
4949
@axes.num_x_ticks = @num_max_slots
5050
labels = @axes.x_ticks || Array.new(@num_max_slots, &:to_s)
5151
labels = labels[0...@axes.num_x_ticks] if labels.size != @axes.num_x_ticks

lib/rubyplot/backend/magick_wrapper.rb

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ def initialize
1818

1919
# Height in pixels of particular text.
2020
# @param text [String] Text to be measured.
21-
2221
def text_height(text, font, font_size)
2322
@draw.pointsize = font_size
2423
@draw.font = font if font
@@ -59,8 +58,8 @@ def draw_text(text,font_color:,font: nil,pointsize:,
5958
@draw.font_weight = font_weight
6059
@draw.gravity = GRAVITY_MEASURE[gravity] || Magick::ForgetGravity
6160
@draw.stroke stroke
62-
@draw.stroke_antialias true
63-
@draw.text_antialias = true
61+
@draw.stroke_antialias false
62+
@draw.text_antialias = false
6463
@draw.rotation = rotation if rotation
6564
@draw.annotate(@base_image, 0,0,x.to_i,y.to_i, text.gsub('%', '%%'))
6665
@draw.rotation = 90.0 if rotation

spec/axes_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@
274274
it "adds bar plot with title margin" do
275275
@figure = Rubyplot::Figure.new
276276
axes = @figure.add_subplot 0,0
277-
axes.bar! do |p|axes =
277+
axes.bar! do |p|
278278
p.data [5,12,9,6,6]
279279
p.label = "data"
280280
p.color = :green
@@ -316,7 +316,7 @@
316316
end
317317
end
318318

319-
it "plots both positive and negative values", focus: true do
319+
it "plots both positive and negative values" do
320320
@figure = Rubyplot::Figure.new
321321
axes = @figure.add_subplot 0,0
322322
axes.bar! do |p|

0 commit comments

Comments
 (0)