@@ -2,6 +2,7 @@ defmodule Matplotex do
22 @ moduledoc """
33 Module to generate a graph.
44 """
5+ alias Matplotex.Figure.Areal.Spline
56 alias Matplotex.Figure.Areal.Histogram
67 alias Matplotex.InputError
78 alias Matplotex.Figure.Radial.Pie
@@ -33,6 +34,9 @@ defmodule Matplotex do
3334 |> BarChart . create ( { pos , values , width } , opts )
3435 end
3536
37+ @ doc """
38+ Creates a scatter plot based on the given data
39+ """
3640 def scatter ( stream , opts ) when is_struct ( stream , Stream ) do
3741 Scatter . create ( stream , opts )
3842 end
@@ -51,6 +55,9 @@ defmodule Matplotex do
5155 |> Scatter . create ( { x , y } , opts )
5256 end
5357
58+ @ doc """
59+ Creates a piec charts based on the size and opts
60+ """
5461 def pie ( sizes , opts \\ [ ] ) do
5562 Pie . create ( % Figure { axes: % Pie { } } , sizes , opts )
5663 end
@@ -84,10 +91,26 @@ defmodule Matplotex do
8491 |> LinePlot . create ( { x , y } , opts )
8592 end
8693
94+ @ doc """
95+ Creates a histogram with given data and bins.
96+
97+ ## Examples
98+
99+ iex> Matplotex.hist([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], 5)
100+ """
101+ def hist ( data , bins ) , do: hist ( data , bins , [ ] )
102+
87103 def hist ( data , bins , opts ) do
88104 Histogram . create ( % Figure { axes: % Histogram { } } , { data , bins } , opts )
89105 end
90106
107+ def spline ( x , y ) , do: spline ( x , y , [ ] )
108+ def spline ( x , y , opts ) , do: spline ( % Figure { axes: % Spline { } } , x , y , opts )
109+
110+ def spline ( % Figure { } = figure , x , y , opts ) do
111+ Spline . create ( figure , { x , y } , opts )
112+ end
113+
91114 @ doc """
92115 Sets X and Y labels for the graph with given font details
93116
0 commit comments