Skip to content

Commit 02013bc

Browse files
Merge pull request #36 from BigThinkcode/refinement
Refinement
2 parents 77824a9 + 7834887 commit 02013bc

File tree

9 files changed

+33
-689
lines changed

9 files changed

+33
-689
lines changed

docs/cheatsheets/cheatsheet1.pdf

313 KB
Binary file not shown.

lib/matplotex/blueprint/frame.ex

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ defmodule Matplotex.Blueprint.Frame do
44
@default_margin 0.05
55
@show_by_default true
66
@valid_by_default true
7+
@default_stroke_grid "#C5C5C5"
8+
@default_stroke_grid_width 1
79
defmacro frame(opts \\ []) do
810
build_struct(opts)
911
end
@@ -70,6 +72,8 @@ defmodule Matplotex.Blueprint.Frame do
7072
label: nil,
7173
scale: nil,
7274
grid: nil,
75+
stroke_grid: @default_stroke_grid,
76+
stroke_grid_width: @default_stroke_grid_width,
7377
size: nil,
7478
axis: nil,
7579
center: nil,

lib/matplotex/figure/areal/bar_chart.ex

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,10 @@ defmodule Matplotex.Figure.Areal.BarChart do
125125
%Dataset{
126126
color: color,
127127
width: width,
128-
pos: pos_factor
128+
pos: pos_factor,
129+
edge_color: edge_color,
130+
alpha: alpha,
131+
line_width: line_width
129132
} = dataset,
130133
bly
131134
) do
@@ -139,7 +142,11 @@ defmodule Matplotex.Figure.Areal.BarChart do
139142
y: y,
140143
width: width,
141144
height: bly - y,
142-
color: color
145+
color: color,
146+
stroke: edge_color || color,
147+
fill_opacity: alpha,
148+
stroke_opacity: alpha,
149+
stroke_width: line_width
143150
}
144151
],
145152
dataset,

lib/matplotex/figure/areal/histogram.ex

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ defmodule Matplotex.Figure.Areal.Histogram do
115115
width: region_width / length(bins),
116116
height: bly - y,
117117
color: color,
118-
stroke: edge_color,
118+
stroke: edge_color || color,
119119
fill_opacity: alpha,
120120
stroke_opacity: alpha
121121
}
@@ -151,15 +151,15 @@ defmodule Matplotex.Figure.Areal.Histogram do
151151
{bins_dist, hists}
152152
end
153153

154-
defp sanitize(%Figure{axes: %__MODULE__{data: {x, y}} = axes} = figure) do
154+
defp sanitize(%Figure{axes: %__MODULE__{data: {x, y}, limit: %TwoD{x: xlim, y: ylim}} = axes} = figure) do
155155
{ymin, ymax} = Enum.min_max(y)
156156
{xmin, xmax} = Enum.min_max(x)
157157

158158
%Figure{
159159
figure
160160
| axes: %__MODULE__{
161161
axes
162-
| limit: %TwoD{x: {floor(xmin), ceil(xmax)}, y: {floor(ymin), ceil(ymax)}}
162+
| limit: %TwoD{x: xlim || {floor(xmin), ceil(xmax)}, y: ylim || {floor(ymin), ceil(ymax)}}
163163
}
164164
}
165165
end

lib/matplotex/figure/areal/spline.ex

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@ defmodule Matplotex.Figure.Areal.Spline do
8888

8989
%Figure{figure | axes: %{axes | element: elements}}
9090
end
91-
9291
defp capture(
9392
%Dataset{
9493
transformed: transformed,
@@ -107,8 +106,7 @@ defmodule Matplotex.Figure.Areal.Spline do
107106
moveto: moveto,
108107
cubic: cubic,
109108
smooths: smooths,
110-
fill: color,
111-
stroke: edge_color,
109+
stroke: color || edge_color,
112110
stroke_width: stroke_width
113111
}
114112
end

0 commit comments

Comments
 (0)