diff --git a/lib/matplotex/blueprint.ex b/lib/matplotex/blueprint.ex index 09980ce..494f4a6 100644 --- a/lib/matplotex/blueprint.ex +++ b/lib/matplotex/blueprint.ex @@ -1,5 +1,5 @@ defmodule Matplotex.Blueprint do -@moduledoc false + @moduledoc false @callback new(graph :: module(), params :: map()) :: any() @callback set_content(graphset :: any()) :: any() @callback add_elements(graphset :: any()) :: any() diff --git a/lib/matplotex/blueprint/chord.ex b/lib/matplotex/blueprint/chord.ex index f8327af..0ec6717 100644 --- a/lib/matplotex/blueprint/chord.ex +++ b/lib/matplotex/blueprint/chord.ex @@ -1,5 +1,5 @@ defmodule Matplotex.Blueprint.Chord do -@moduledoc false + @moduledoc false @true_by_default false @false_by_default true defmacro chord(opts \\ []) do diff --git a/lib/matplotex/blueprint/frame.ex b/lib/matplotex/blueprint/frame.ex index 6c09dc3..e3a477f 100644 --- a/lib/matplotex/blueprint/frame.ex +++ b/lib/matplotex/blueprint/frame.ex @@ -1,5 +1,5 @@ defmodule Matplotex.Blueprint.Frame do -@moduledoc false + @moduledoc false alias Matplotex.Figure.Legend @default_margin 0.05 @show_by_default true diff --git a/lib/matplotex/element.ex b/lib/matplotex/element.ex index ebcf5cf..81bec7b 100644 --- a/lib/matplotex/element.ex +++ b/lib/matplotex/element.ex @@ -1,5 +1,5 @@ defmodule Matplotex.Element do -@moduledoc false + @moduledoc false @callback assemble(element :: struct()) :: String.t() def assemble(%module{} = element), do: module.assemble(element) diff --git a/lib/matplotex/element/circle.ex b/lib/matplotex/element/circle.ex index b9376b5..aa16616 100644 --- a/lib/matplotex/element/circle.ex +++ b/lib/matplotex/element/circle.ex @@ -1,5 +1,5 @@ defmodule Matplotex.Element.Circle do -@moduledoc false + @moduledoc false alias Matplotex.Element use Element diff --git a/lib/matplotex/element/label.ex b/lib/matplotex/element/label.ex index 0f664da..1ad192c 100644 --- a/lib/matplotex/element/label.ex +++ b/lib/matplotex/element/label.ex @@ -1,5 +1,5 @@ defmodule Matplotex.Element.Label do -@moduledoc false + @moduledoc false alias Matplotex.Element use Element @default_fill "black" diff --git a/lib/matplotex/element/legend.ex b/lib/matplotex/element/legend.ex index 2124be8..768ba4c 100644 --- a/lib/matplotex/element/legend.ex +++ b/lib/matplotex/element/legend.ex @@ -1,5 +1,5 @@ defmodule Matplotex.Element.Legend do -@moduledoc false + @moduledoc false alias Matplotex.Element.Label alias Matplotex.Element diff --git a/lib/matplotex/element/line.ex b/lib/matplotex/element/line.ex index fce6a6c..d6964d1 100644 --- a/lib/matplotex/element/line.ex +++ b/lib/matplotex/element/line.ex @@ -1,5 +1,5 @@ defmodule Matplotex.Element.Line do -@moduledoc false + @moduledoc false alias Matplotex.Element use Element diff --git a/lib/matplotex/element/polygon.ex b/lib/matplotex/element/polygon.ex index b7ca54e..7f53431 100644 --- a/lib/matplotex/element/polygon.ex +++ b/lib/matplotex/element/polygon.ex @@ -1,5 +1,5 @@ defmodule Matplotex.Element.Polygon do -@moduledoc false + @moduledoc false alias Matplotex.Element use Element @default_fill "blue" diff --git a/lib/matplotex/element/rad_legend.ex b/lib/matplotex/element/rad_legend.ex index bcfa37b..aa37de4 100644 --- a/lib/matplotex/element/rad_legend.ex +++ b/lib/matplotex/element/rad_legend.ex @@ -1,5 +1,5 @@ defmodule Matplotex.Element.RadLegend do -@moduledoc false + @moduledoc false alias Matplotex.Utils.Algebra alias Matplotex.Element.Label alias Matplotex.Element @@ -13,7 +13,7 @@ defmodule Matplotex.Element.RadLegend do @label_type "legend.label" @default_opacity 1.0 - @legend_padding 5/96 + @legend_padding 5 / 96 defstruct [ :type, :x, @@ -47,7 +47,8 @@ defmodule Matplotex.Element.RadLegend do } = legend, legend_font ) do - {label_x, label_y} = Algebra.transform_given_point(x, y, width + @legend_padding, height/2) + {label_x, label_y} = Algebra.transform_given_point(x, y, width + @legend_padding, height / 2) + %{ legend | label: diff --git a/lib/matplotex/element/rect.ex b/lib/matplotex/element/rect.ex index 689ccc9..fa6e0fb 100644 --- a/lib/matplotex/element/rect.ex +++ b/lib/matplotex/element/rect.ex @@ -1,5 +1,5 @@ defmodule Matplotex.Element.Rect do -@moduledoc false + @moduledoc false alias Matplotex.Element @default_stroke_width 2 diff --git a/lib/matplotex/element/slice.ex b/lib/matplotex/element/slice.ex index bee7dcd..e4626c1 100644 --- a/lib/matplotex/element/slice.ex +++ b/lib/matplotex/element/slice.ex @@ -1,5 +1,5 @@ defmodule Matplotex.Element.Slice do -@moduledoc false + @moduledoc false alias Matplotex.Element use Element diff --git a/lib/matplotex/element/spline.ex b/lib/matplotex/element/spline.ex index 630af28..47cf0a1 100644 --- a/lib/matplotex/element/spline.ex +++ b/lib/matplotex/element/spline.ex @@ -1,5 +1,5 @@ defmodule Matplotex.Element.Spline do -@moduledoc false + @moduledoc false alias Matplotex.Element use Element @default_stroke_width 2 diff --git a/lib/matplotex/element/stencil.ex b/lib/matplotex/element/stencil.ex index 0d69508..28cd691 100644 --- a/lib/matplotex/element/stencil.ex +++ b/lib/matplotex/element/stencil.ex @@ -1,5 +1,5 @@ defmodule Matplotex.Element.Stencil do -@moduledoc false + @moduledoc false def line(line) do ~s( module.materialized_by_region()|>module.materialize() + def materialize(%__MODULE__{axes: %module{}} = figure), + do: figure |> module.materialized_by_region() |> module.materialize() def update_figure(figure, params) do if valid_params?(params) do diff --git a/lib/matplotex/figure/areal.ex b/lib/matplotex/figure/areal.ex index 261ad6c..6ba5d40 100644 --- a/lib/matplotex/figure/areal.ex +++ b/lib/matplotex/figure/areal.ex @@ -1,5 +1,5 @@ defmodule Matplotex.Figure.Areal do -@moduledoc false + @moduledoc false alias Matplotex.Figure.Areal.Ticker alias Matplotex.Utils.Algebra alias Matplotex.Figure.Dataset @@ -360,5 +360,4 @@ defmodule Matplotex.Figure.Areal do %Dataset{dataset | transformed: transformed} end - end diff --git a/lib/matplotex/figure/areal/bar_chart.ex b/lib/matplotex/figure/areal/bar_chart.ex index 87ea348..77ce19a 100644 --- a/lib/matplotex/figure/areal/bar_chart.ex +++ b/lib/matplotex/figure/areal/bar_chart.ex @@ -1,5 +1,5 @@ defmodule Matplotex.Figure.Areal.BarChart do -@moduledoc false + @moduledoc false import Matplotex.Figure.Numer alias Matplotex.Figure.Areal.PlotOptions alias Matplotex.Figure.Areal.Region @@ -48,7 +48,7 @@ defmodule Matplotex.Figure.Areal.BarChart do @impl Areal def materialize(figure) do - materialize_bars(figure) + materialize_bars(figure) end defp materialize_bars( diff --git a/lib/matplotex/figure/areal/histogram.ex b/lib/matplotex/figure/areal/histogram.ex index f781e7f..bc9dc0f 100644 --- a/lib/matplotex/figure/areal/histogram.ex +++ b/lib/matplotex/figure/areal/histogram.ex @@ -1,5 +1,5 @@ defmodule Matplotex.Figure.Areal.Histogram do -@moduledoc false + @moduledoc false alias Matplotex.Element.Rect alias Matplotex.Figure.RcParams alias Matplotex.Figure.Areal.PlotOptions @@ -150,7 +150,9 @@ defmodule Matplotex.Figure.Areal.Histogram do {bins_dist, hists} end - defp sanitize(%Figure{axes: %__MODULE__{data: {x, y}, limit: %TwoD{x: xlim, y: ylim}} = 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) @@ -158,7 +160,10 @@ defmodule Matplotex.Figure.Areal.Histogram do figure | axes: %__MODULE__{ axes - | limit: %TwoD{x: xlim || {floor(xmin), ceil(xmax)}, y: ylim || {floor(ymin), ceil(ymax)}} + | limit: %TwoD{ + x: xlim || {floor(xmin), ceil(xmax)}, + y: ylim || {floor(ymin), ceil(ymax)} + } } } end diff --git a/lib/matplotex/figure/areal/line_plot.ex b/lib/matplotex/figure/areal/line_plot.ex index b39e62f..c977c8c 100644 --- a/lib/matplotex/figure/areal/line_plot.ex +++ b/lib/matplotex/figure/areal/line_plot.ex @@ -1,5 +1,5 @@ defmodule Matplotex.Figure.Areal.LinePlot do -@moduledoc false + @moduledoc false alias Matplotex.Figure.Areal.PlotOptions alias Matplotex.Utils.Algebra alias Matplotex.Figure.Areal.Region diff --git a/lib/matplotex/figure/areal/plot_options.ex b/lib/matplotex/figure/areal/plot_options.ex index 53a557e..c50fdcd 100644 --- a/lib/matplotex/figure/areal/plot_options.ex +++ b/lib/matplotex/figure/areal/plot_options.ex @@ -1,5 +1,5 @@ defmodule Matplotex.Figure.Areal.PlotOptions do -@moduledoc false + @moduledoc false alias Matplotex.Figure alias Matplotex.Figure.TwoD alias Matplotex.Figure.RcParams diff --git a/lib/matplotex/figure/areal/region.ex b/lib/matplotex/figure/areal/region.ex index f338e96..6a70c0d 100644 --- a/lib/matplotex/figure/areal/region.ex +++ b/lib/matplotex/figure/areal/region.ex @@ -1,5 +1,5 @@ defmodule Matplotex.Figure.Areal.Region do -@moduledoc false + @moduledoc false alias Matplotex.Figure.Areal.XyRegion.Coords @zero_by_default 0 defstruct x: @zero_by_default, diff --git a/lib/matplotex/figure/areal/scatter.ex b/lib/matplotex/figure/areal/scatter.ex index 07ae2d6..cde60da 100644 --- a/lib/matplotex/figure/areal/scatter.ex +++ b/lib/matplotex/figure/areal/scatter.ex @@ -1,5 +1,5 @@ defmodule Matplotex.Figure.Areal.Scatter do -@moduledoc false + @moduledoc false alias Matplotex.Figure.Areal.PlotOptions alias Matplotex.Figure.Areal.Region alias Matplotex.Figure.Areal.Ticker diff --git a/lib/matplotex/figure/areal/spline.ex b/lib/matplotex/figure/areal/spline.ex index 2e2ba2a..081b971 100644 --- a/lib/matplotex/figure/areal/spline.ex +++ b/lib/matplotex/figure/areal/spline.ex @@ -1,5 +1,5 @@ defmodule Matplotex.Figure.Areal.Spline do -@moduledoc false + @moduledoc false alias Matplotex.Element.Spline alias Matplotex.Figure.RcParams alias Matplotex.Figure.Areal @@ -86,6 +86,7 @@ defmodule Matplotex.Figure.Areal.Spline do %Figure{figure | axes: %{axes | element: elements}} end + defp capture( %Dataset{ transformed: transformed, @@ -98,6 +99,7 @@ defmodule Matplotex.Figure.Areal.Spline do {moveto, transformed} = List.pop_at(transformed, 0, move_to_def) cubic = Enum.slice(transformed, 0..2) smooths = blend(transformed, 3) + %Spline{ type: "figure.spline", moveto: moveto, diff --git a/lib/matplotex/figure/areal/step.ex b/lib/matplotex/figure/areal/step.ex index 0783871..5e513cb 100644 --- a/lib/matplotex/figure/areal/step.ex +++ b/lib/matplotex/figure/areal/step.ex @@ -1,5 +1,4 @@ defmodule Matplotex.Figure.Areal.Step do - alias Matplotex.Figure.Areal.LinePlot alias Matplotex.Figure alias Matplotex.InputError @@ -7,31 +6,35 @@ defmodule Matplotex.Figure.Areal.Step do def create(x, y, opts) do {x, y} = step_segments(x, y) LinePlot.create(%Figure{axes: %LinePlot{}}, {x, y}, opts) - end - def create(%Figure{} = figure, x, y, opts) do - {x, y} = step_segments(x, y) - LinePlot.create(figure, {x, y}, opts) - end - defp step_segments(x, y) do - x = horizontal_segments(x) - y = vertical_segments(y) - {x,y} - end - defp horizontal_segments(data) when is_list(data) do - first_value = List.first(data) - second_last_index = length(data) - 1 - repeated = data|>Enum.slice(1..second_last_index)|>List.duplicate(2)|> List.flatten() - [first_value | repeated]|>Enum.sort() - end - defp horizontal_segments(_data), do: list_error(:y) - - defp vertical_segments(data) when is_list(data) do - data|>List.duplicate(2)|>List.flatten()|>Enum.sort() - end - defp vertical_segments(_data), do: list_error(:y) - - defp list_error(arg) do - raise InputError, message: "Expected a list for arg: #{arg}" - end + end + + def create(%Figure{} = figure, x, y, opts) do + {x, y} = step_segments(x, y) + LinePlot.create(figure, {x, y}, opts) + end + + defp step_segments(x, y) do + x = horizontal_segments(x) + y = vertical_segments(y) + {x, y} + end + + defp horizontal_segments(data) when is_list(data) do + first_value = List.first(data) + second_last_index = length(data) - 1 + repeated = data |> Enum.slice(1..second_last_index) |> List.duplicate(2) |> List.flatten() + [first_value | repeated] |> Enum.sort() + end + + defp horizontal_segments(_data), do: list_error(:y) + + defp vertical_segments(data) when is_list(data) do + data |> List.duplicate(2) |> List.flatten() |> Enum.sort() + end + + defp vertical_segments(_data), do: list_error(:y) + defp list_error(arg) do + raise InputError, message: "Expected a list for arg: #{arg}" + end end diff --git a/lib/matplotex/figure/areal/ticker.ex b/lib/matplotex/figure/areal/ticker.ex index 7da4883..726c585 100644 --- a/lib/matplotex/figure/areal/ticker.ex +++ b/lib/matplotex/figure/areal/ticker.ex @@ -1,5 +1,5 @@ defmodule Matplotex.Figure.Areal.Ticker do -@moduledoc false + @moduledoc false @tick_in_plot 5 def generate_ticks({min, max}) do step = (max - min) / @tick_in_plot diff --git a/lib/matplotex/figure/areal/xy_region/coords.ex b/lib/matplotex/figure/areal/xy_region/coords.ex index cc231f4..3d40b32 100644 --- a/lib/matplotex/figure/areal/xy_region/coords.ex +++ b/lib/matplotex/figure/areal/xy_region/coords.ex @@ -1,4 +1,4 @@ defmodule Matplotex.Figure.Areal.XyRegion.Coords do -@moduledoc false + @moduledoc false defstruct [:label, :ticks, :grids] end diff --git a/lib/matplotex/figure/cast.ex b/lib/matplotex/figure/cast.ex index f4d8bf0..cdc78c8 100644 --- a/lib/matplotex/figure/cast.ex +++ b/lib/matplotex/figure/cast.ex @@ -1,5 +1,5 @@ defmodule Matplotex.Figure.Cast do -@moduledoc false + @moduledoc false alias Matplotex.Figure.Lead alias Matplotex.Element.Legend alias Matplotex.Utils.Algebra @@ -18,7 +18,6 @@ defmodule Matplotex.Figure.Cast do @lowest_tick 0 @zero_to_move 0 - def cast_spines_by_region( %Figure{ axes: @@ -128,14 +127,12 @@ defmodule Matplotex.Figure.Cast do %Figure{figure | axes: %{axes | element: elements ++ [title]}} end - def cast_label_by_region(figure) do figure |> cast_xlabel_by_region() |> cast_ylabel_by_region() end - def cast_xlabel_by_region( %Figure{ axes: %{label: %{x: x_label}, region_x: region_x, element: element} = axes, @@ -183,7 +180,9 @@ defmodule Matplotex.Figure.Cast do element = element ++ [y_label] %Figure{figure | axes: %{axes | element: element}} end - def cast_ylabel_by_region(figure), do: figure + + def cast_ylabel_by_region(figure), do: figure + def cast_xticks_by_region( %Figure{ axes: @@ -311,7 +310,6 @@ defmodule Matplotex.Figure.Cast do } } = figure ) do - y_ticks = confine_ticks(y_ticks, ylim) y_data = confine_data(y_data, ylim) dataset = confine_data(dataset, ylim, :y) diff --git a/lib/matplotex/figure/coords.ex b/lib/matplotex/figure/coords.ex index bd83335..44e5d30 100644 --- a/lib/matplotex/figure/coords.ex +++ b/lib/matplotex/figure/coords.ex @@ -1,5 +1,5 @@ defmodule Matplotex.Figure.Coords do -@moduledoc false + @moduledoc false defstruct [ :title, :x_label, diff --git a/lib/matplotex/figure/dataset.ex b/lib/matplotex/figure/dataset.ex index d47febd..58d0af6 100644 --- a/lib/matplotex/figure/dataset.ex +++ b/lib/matplotex/figure/dataset.ex @@ -1,5 +1,5 @@ defmodule Matplotex.Figure.Dataset do -@moduledoc false + @moduledoc false @default_color "blue" @default_marker "o" @default_linestyle "_" diff --git a/lib/matplotex/figure/dimension.ex b/lib/matplotex/figure/dimension.ex index ea68e76..f6aa4ca 100644 --- a/lib/matplotex/figure/dimension.ex +++ b/lib/matplotex/figure/dimension.ex @@ -1,4 +1,4 @@ defmodule Matplotex.Figure.Dimension do -@moduledoc false + @moduledoc false defstruct [:x_label, :y_label, :x_tick, :y_tick, :title] end diff --git a/lib/matplotex/figure/font.ex b/lib/matplotex/figure/font.ex index ed6b21c..3b75489 100644 --- a/lib/matplotex/figure/font.ex +++ b/lib/matplotex/figure/font.ex @@ -1,5 +1,5 @@ defmodule Matplotex.Figure.Font do -@moduledoc false + @moduledoc false @default_font_color "black" @default_font_family "Arial, Verdana, sans-serif" @default_font_style "normal" diff --git a/lib/matplotex/figure/lead.ex b/lib/matplotex/figure/lead.ex index 11b5f06..6933343 100644 --- a/lib/matplotex/figure/lead.ex +++ b/lib/matplotex/figure/lead.ex @@ -1,5 +1,5 @@ defmodule Matplotex.Figure.Lead do -@moduledoc false + @moduledoc false alias Matplotex.Utils.Algebra alias Matplotex.Figure.Areal.XyRegion.Coords, as: XyCoords alias Matplotex.Figure.Font @@ -66,7 +66,6 @@ defmodule Matplotex.Figure.Lead do } = axes } = figure ) do - {x_ticks, x_lim} = maybe_generate_ticks(x_ticks, x_lim, x_data, x_ticks_count || width) {y_ticks, y_limt} = maybe_generate_ticks(y_ticks, y_lim, y_data, y_ticks_count || height) diff --git a/lib/matplotex/figure/legend.ex b/lib/matplotex/figure/legend.ex index 63970f9..53d6dba 100644 --- a/lib/matplotex/figure/legend.ex +++ b/lib/matplotex/figure/legend.ex @@ -1,5 +1,5 @@ defmodule Matplotex.Figure.Legend do -@moduledoc false + @moduledoc false defstruct [:labels, :title, :colors, :position, :size] @type t() :: %__MODULE__{labels: list(), title: String.t(), position: atom(), size: tuple()} diff --git a/lib/matplotex/figure/marker.ex b/lib/matplotex/figure/marker.ex index 297e30d..02095c7 100644 --- a/lib/matplotex/figure/marker.ex +++ b/lib/matplotex/figure/marker.ex @@ -1,5 +1,5 @@ defmodule Matplotex.Figure.Marker do -@moduledoc false + @moduledoc false alias Matplotex.Utils.Algebra alias Matplotex.Element.Rect alias Matplotex.Element.Polygon diff --git a/lib/matplotex/figure/numer.ex b/lib/matplotex/figure/numer.ex index c3cb669..8aa1e6d 100644 --- a/lib/matplotex/figure/numer.ex +++ b/lib/matplotex/figure/numer.ex @@ -1,5 +1,5 @@ defmodule Matplotex.Figure.Numer do -@moduledoc false + @moduledoc false def round_to_best(value) when value > 10 do factor = value |> :math.log10() |> floor() diff --git a/lib/matplotex/figure/radial.ex b/lib/matplotex/figure/radial.ex index f8724c7..0a1ce21 100644 --- a/lib/matplotex/figure/radial.ex +++ b/lib/matplotex/figure/radial.ex @@ -1,5 +1,5 @@ defmodule Matplotex.Figure.Radial do -@moduledoc false + @moduledoc false alias Matplotex.Utils.Algebra @callback create(struct(), list(), keyword()) :: struct() diff --git a/lib/matplotex/figure/radial/accumulator.ex b/lib/matplotex/figure/radial/accumulator.ex index a594973..a1cd7b5 100644 --- a/lib/matplotex/figure/radial/accumulator.ex +++ b/lib/matplotex/figure/radial/accumulator.ex @@ -1,5 +1,5 @@ defmodule Matplotex.Figure.Radial.Accumulator do -@moduledoc false + @moduledoc false alias Matplotex.Figure.Radial.LegendAcc @start_angle :math.pi() / 2 diff --git a/lib/matplotex/figure/radial/dataset.ex b/lib/matplotex/figure/radial/dataset.ex index a0ebd43..817b2ac 100644 --- a/lib/matplotex/figure/radial/dataset.ex +++ b/lib/matplotex/figure/radial/dataset.ex @@ -1,5 +1,5 @@ defmodule Matplotex.Figure.Radial.Dataset do -@moduledoc false + @moduledoc false defstruct sizes: [], labels: [], colors: [], diff --git a/lib/matplotex/figure/radial/legend_acc.ex b/lib/matplotex/figure/radial/legend_acc.ex index bce62eb..3a4bbd6 100644 --- a/lib/matplotex/figure/radial/legend_acc.ex +++ b/lib/matplotex/figure/radial/legend_acc.ex @@ -1,4 +1,4 @@ defmodule Matplotex.Figure.Radial.LegendAcc do -@moduledoc false + @moduledoc false defstruct [:x, :y, :uheight, :uwidth] end diff --git a/lib/matplotex/figure/radial/pie.ex b/lib/matplotex/figure/radial/pie.ex index 7ecb944..9b6784e 100644 --- a/lib/matplotex/figure/radial/pie.ex +++ b/lib/matplotex/figure/radial/pie.ex @@ -1,5 +1,5 @@ defmodule Matplotex.Figure.Radial.Pie do -@moduledoc false + @moduledoc false alias Matplotex.Figure.RcParams alias Matplotex.Utils.Algebra alias Matplotex.Figure.Areal.Region @@ -16,7 +16,7 @@ defmodule Matplotex.Figure.Radial.Pie do use Radial @full_circle 2 * :math.pi() - @legend_padding 5/96 + @legend_padding 5 / 96 chord( center: %TwoD{}, lead: %TwoD{}, diff --git a/lib/matplotex/figure/rc_params.ex b/lib/matplotex/figure/rc_params.ex index 328e424..9bdc987 100644 --- a/lib/matplotex/figure/rc_params.ex +++ b/lib/matplotex/figure/rc_params.ex @@ -1,5 +1,5 @@ defmodule Matplotex.Figure.RcParams do -@moduledoc false + @moduledoc false alias Matplotex.Figure.Font @default_figsize {8, 6} @default_dpi 96 diff --git a/lib/matplotex/figure/sketch.ex b/lib/matplotex/figure/sketch.ex index 87d2a8f..1315ef5 100644 --- a/lib/matplotex/figure/sketch.ex +++ b/lib/matplotex/figure/sketch.ex @@ -1,5 +1,5 @@ defmodule Matplotex.Figure.Sketch do -@moduledoc false + @moduledoc false alias Matplotex.Figure @dpi 96 diff --git a/lib/matplotex/figure/text.ex b/lib/matplotex/figure/text.ex index 85eea7a..159bb1e 100644 --- a/lib/matplotex/figure/text.ex +++ b/lib/matplotex/figure/text.ex @@ -1,5 +1,5 @@ defmodule Matplotex.Figure.Text do -@moduledoc false + @moduledoc false alias Matplotex.Figure.Text alias Matplotex.Figure.Font diff --git a/lib/matplotex/figure/two_d.ex b/lib/matplotex/figure/two_d.ex index 1c3cf37..162d9b5 100644 --- a/lib/matplotex/figure/two_d.ex +++ b/lib/matplotex/figure/two_d.ex @@ -1,5 +1,5 @@ defmodule Matplotex.Figure.TwoD do -@moduledoc false + @moduledoc false defstruct [:x, :y] def update(%__MODULE__{x: x, y: y} = twod, opts, context) do diff --git a/lib/matplotex/utils/algebra.ex b/lib/matplotex/utils/algebra.ex index 56caa53..81360c1 100644 --- a/lib/matplotex/utils/algebra.ex +++ b/lib/matplotex/utils/algebra.ex @@ -1,5 +1,5 @@ defmodule Matplotex.Utils.Algebra do -@moduledoc false + @moduledoc false alias Nx @tensor_data_type_bits 64 diff --git a/lib/matplotex/utils/helpers.ex b/lib/matplotex/utils/helpers.ex index d57a033..38eacc6 100644 --- a/lib/matplotex/utils/helpers.ex +++ b/lib/matplotex/utils/helpers.ex @@ -1,5 +1,5 @@ defmodule Matplotex.Utils.Helpers do -@moduledoc false + @moduledoc false # @moduledoc """ # Module contains some misslenious helper functions # """ diff --git a/lib/matplotex/utils/input_error.ex b/lib/matplotex/utils/input_error.ex index 7105505..6b01259 100644 --- a/lib/matplotex/utils/input_error.ex +++ b/lib/matplotex/utils/input_error.ex @@ -1,4 +1,4 @@ defmodule Matplotex.InputError do -@moduledoc false + @moduledoc false defexception [:keys, :message] end diff --git a/lib/matplotex/utils/math_func.ex b/lib/matplotex/utils/math_func.ex index 09a23f1..5cc66a2 100644 --- a/lib/matplotex/utils/math_func.ex +++ b/lib/matplotex/utils/math_func.ex @@ -1,5 +1,5 @@ defmodule Matplotex.Utilities.MathFunc do -@moduledoc false + @moduledoc false alias NX @tensor_double_data_type_bits 64 def euclidean_distance(x1, y1, x2, y2) do diff --git a/lib/matplotex/utils/svg.ex b/lib/matplotex/utils/svg.ex index c02610e..8c9a443 100644 --- a/lib/matplotex/utils/svg.ex +++ b/lib/matplotex/utils/svg.ex @@ -1,5 +1,5 @@ defmodule Matplotex.Utils.Svg do -@moduledoc false + @moduledoc false def wrap_with_frame(%{width: width, height: height}, svg) do ~s(BarChart.materialize() + assert %Figure{axes: %{element: elements}} = + BarChart.materialized_by_region(figure) |> BarChart.materialize() assert assert Enum.filter(elements, fn x -> x.type == "figure.bar" end) |> length() == length(y) diff --git a/test/matplotex_test.exs b/test/matplotex_test.exs index f540799..e592ea7 100644 --- a/test/matplotex_test.exs +++ b/test/matplotex_test.exs @@ -308,13 +308,15 @@ defmodule MatplotexTest do describe "step" do test "creates a figure for step plot" do x = [1, 2, 3, 4, 5] - y = [1,4,9,16,25] + y = [1, 4, 9, 16, 25] + assert %Figure{axes: %{dataset: [data1], label: label}} = - Matplotex.step(x, y, x_label: "X", y_label: "Y") - assert label.x == "X" - assert label.y == "Y" - assert data1.x|>Enum.uniq() == x - assert data1.y|>Enum.uniq() == y + Matplotex.step(x, y, x_label: "X", y_label: "Y") + + assert label.x == "X" + assert label.y == "Y" + assert data1.x |> Enum.uniq() == x + assert data1.y |> Enum.uniq() == y end end end