forked from SciRuby/rubyplot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrubyplot.rb
180 lines (164 loc) · 3.28 KB
/
rubyplot.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
require 'bigdecimal'
unless ENV["RUBYPLOT_BACKEND"]
ENV["RUBYPLOT_BACKEND"] = "GR"
end
require 'rubyplot/color'
require 'rubyplot/utils'
require 'rubyplot/version'
require 'rubyplot/themes'
require 'rubyplot/artist'
require 'rubyplot/backend'
require 'rubyplot/figure'
require 'rubyplot/subplot'
require 'rubyplot/spi'
require 'rubyplot/image'
module Rubyplot
LINE_TYPES = [
:solid,
:dashed,
:dotted,
:dashed_dotted,
:dash_2_dot,
:dash_3_dot,
:long_dash,
:long_short_dash,
:spaced_dash,
:spaced_dot,
:double_dot,
:triple_dot,
].freeze
MARKER_TYPES = [
:dot,
:plus,
:asterisk,
:circle,
:diagonal_cross,
:solid_circle,
:triangle_up,
:solid_triangle_up,
:triangle_down,
:solid_triangle_down,
:square,
:solid_square,
:bowtie,
:solid_bowtie,
:hglass,
:solid_hglass,
:diamond,
:solid_diamond,
:star,
:solid_star,
:tri_up_down,
:solid_tri_right,
:solid_tri_left,
:hollow_plus,
:solid_plus,
:pentagon,
:hexagon,
:heptagon,
:octagon,
:star_4,
:star_5,
:star_6,
:star_7,
:star_8,
:vline,
:hline,
:omark
].freeze
TEXT_FONTS = [
:times_roman,
:times_italic,
:times_bold,
:times_bolditalic,
:helvetica,
:helvetica_oblique,
:helvetica_bold,
:helvetica_boldoblique,
:courier,
:courier_oblique,
:courier_bold,
:courier_boldoblique,
:symbol,
:bookman_light,
:bookman_lightitalic,
:bookman_demi,
:bookman_demiitalic,
:newcenturyschlbk_roman,
:newcenturyschlbk_italic,
:newcenturyschlbk_bold,
:newcenturyschlbk_bolditalic,
:avantgarde_book,
:avantgarde_bookoblique,
:avantgarde_demi,
:avantgarde_demioblique,
:palatino_roman,
:palatino_italic,
:palatino_bold,
:palatino_bolditalic,
:zapfchancery_mediumitalic,
:zapfdingbats
].freeze
TEXT_PRECISION = [
:high,
:med,
:low
].freeze
TEXT_DIRECTION = [
:left_right,
:right_left,
:down_up,
:up_down
].freeze
FILL_STYLES = [
:hollow,
:solid,
:pattern,
:hatch
].freeze
ARROW_STYLES = [
:simple_single_ended,
:simple_single_ended_acute,
:hollow_single_ended,
:filled_singled_ended,
:triangle_single_ended,
:filled_triangle_single_ended,
:kite_single_ended,
:filled_kite_single_ended,
:simple_double_ended,
:simple_double_ended_acute,
:hollow_double_ended,
:filled_double_ended,
:triangle_double_ended,
:filled_triangle_double_ended,
:kite_double_ended,
:filled_kite_double_ended,
:double_line_single_ended,
:double_line_double_ended
].freeze
class << self
attr_accessor :iruby_inline
def backend
@backend
end
def inline
@iruby_inline = true
end
def stop_inline
@iruby_inline = false
end
def QuantumRange
# Setting Backend to Magick as Image is only implemented for Magick backend
@backend = Rubyplot::Backend::MagickWrapper.new
Rubyplot.backend.QuantumRange
end
def set_backend b
case b
when :magick
@backend = Rubyplot::Backend::MagickWrapper.new
when :gr
@backend = Rubyplot::Backend::GRWrapper.new
end
end
end
end # module Rubyplot