Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added docs/cheatsheets/cheatsheet1.pdf
Binary file not shown.
4 changes: 4 additions & 0 deletions lib/matplotex/blueprint/frame.ex
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ defmodule Matplotex.Blueprint.Frame do
@default_margin 0.05
@show_by_default true
@valid_by_default true
@default_stroke_grid "#C5C5C5"
@default_stroke_grid_width 1
defmacro frame(opts \\ []) do
build_struct(opts)
end
Expand Down Expand Up @@ -70,6 +72,8 @@ defmodule Matplotex.Blueprint.Frame do
label: nil,
scale: nil,
grid: nil,
stroke_grid: @default_stroke_grid,
stroke_grid_width: @default_stroke_grid_width,
size: nil,
axis: nil,
center: nil,
Expand Down
11 changes: 9 additions & 2 deletions lib/matplotex/figure/areal/bar_chart.ex
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,10 @@ defmodule Matplotex.Figure.Areal.BarChart do
%Dataset{
color: color,
width: width,
pos: pos_factor
pos: pos_factor,
edge_color: edge_color,
alpha: alpha,
line_width: line_width
} = dataset,
bly
) do
Expand All @@ -139,7 +142,11 @@ defmodule Matplotex.Figure.Areal.BarChart do
y: y,
width: width,
height: bly - y,
color: color
color: color,
stroke: edge_color || color,
fill_opacity: alpha,
stroke_opacity: alpha,
stroke_width: line_width
}
],
dataset,
Expand Down
6 changes: 3 additions & 3 deletions lib/matplotex/figure/areal/histogram.ex
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ defmodule Matplotex.Figure.Areal.Histogram do
width: region_width / length(bins),
height: bly - y,
color: color,
stroke: edge_color,
stroke: edge_color || color,
fill_opacity: alpha,
stroke_opacity: alpha
}
Expand Down Expand Up @@ -151,15 +151,15 @@ defmodule Matplotex.Figure.Areal.Histogram do
{bins_dist, hists}
end

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

%Figure{
figure
| axes: %__MODULE__{
axes
| limit: %TwoD{x: {floor(xmin), ceil(xmax)}, y: {floor(ymin), ceil(ymax)}}
| limit: %TwoD{x: xlim || {floor(xmin), ceil(xmax)}, y: ylim || {floor(ymin), ceil(ymax)}}
}
}
end
Expand Down
4 changes: 1 addition & 3 deletions lib/matplotex/figure/areal/spline.ex
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ defmodule Matplotex.Figure.Areal.Spline do

%Figure{figure | axes: %{axes | element: elements}}
end

defp capture(
%Dataset{
transformed: transformed,
Expand All @@ -107,8 +106,7 @@ defmodule Matplotex.Figure.Areal.Spline do
moveto: moveto,
cubic: cubic,
smooths: smooths,
fill: color,
stroke: edge_color,
stroke: color || edge_color,
stroke_width: stroke_width
}
end
Expand Down
Loading