148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
|
# File 'lib/charty/backends/pyplot.rb', line 148
def bar(bar_pos, _group_names, values, colors, orient, label: nil, width: 0.8r,
align: :center, conf_int: nil, error_colors: nil, error_width: nil, cap_size: nil)
bar_pos = Array(bar_pos)
values = Array(values)
colors = Array(colors).map(&:to_hex_string)
width = Float(width)
ax = @pyplot.gca
kw = {color: colors, align: align}
kw[:label] = label unless label.nil?
if orient == :v
ax.bar(bar_pos, values, width, **kw)
else
ax.barh(bar_pos, values, width, **kw)
end
if conf_int
error_colors = Array(error_colors).map(&:to_hex_string)
confidence_intervals(ax, bar_pos, conf_int, orient, error_colors, error_width, cap_size)
end
end
|