Skip to content
Merged

Docs #29

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
56 changes: 27 additions & 29 deletions lib/matplotex.ex
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ defmodule Matplotex do

## Supported Graph Types

Matplotex supports the following types of visualizations:

- Line Plots
- Bar Charts
- Pie Charts
- Spline Graphs
- Histograms
- Scatter Plots
## Examples
Matplotex supports the following types of visualizations:

- Line Plots
- Bar Charts
- Pie Charts
- Spline Graphs
- Histograms
- Scatter Plots
## Examples
```elixir
alias Matplotex as: M

Expand Down Expand Up @@ -86,35 +86,35 @@ Matplotex supports the following types of visualizations:
**Note**: Both approaches are equivalent, and users can choose whichever pattern is more convenient.


## Runtime Configuration (RC Params)
The function M.set_rc_params/2 allows you to set runtime configuration parameters for the plot, such as font sizes, colors, and line styles. These settings affect visual elements like the font style and size for the labels, ticks, and title.
## Runtime Configuration (RC Params)
The function M.set_rc_params/2 allows you to set runtime configuration parameters for the plot, such as font sizes, colors, and line styles. These settings affect visual elements like the font style and size for the labels, ticks, and title.

By default, the plot starts with standard values (e.g., Arial or Verdana font, size 12). You can modify these using the RC parameters.
By default, the plot starts with standard values (e.g., Arial or Verdana font, size 12). You can modify these using the RC parameters.

### Available RC Params:
line_width, line_style
grid_color, grid_linestyle, grid_alpha
tick_line_length
x_padding, y_padding, padding
legend_width
Refer to specific plot documentation for detailed information on padding usage.
### Available RC Params:
line_width, line_style
grid_color, grid_linestyle, grid_alpha
tick_line_length
x_padding, y_padding, padding
legend_width
Refer to specific plot documentation for detailed information on padding usage.


## Elements
The output format of the plot is SVG will support more formats in future, anyway the svg is a group of some elements put together, throught the execution
it is generating those elements through elixir data structure, all element data structure contains some svg equivalent data that converts the elements to
SVG string, the output SVG string can be used directly in the web application.

## Figure Data Structure
The main data structure used to generate a plot is Matplotex.Figure, which contains all the necessary information for the plot, including:
## Figure Data Structure
The main data structure used to generate a plot is Matplotex.Figure, which contains all the necessary information for the plot, including:

- `:figsize`: A tuple specifying the width and height of the figure (e.g., {10, 6}).
- `:axes`: Contains the axes data, which varies depending on the plot type.
- `:rc_params`: The runtime configuration parameters.
- `:margin`: Specifies the margin of the figure.
- `:figsize`: A tuple specifying the width and height of the figure (e.g., {10, 6}).
- `:axes`: Contains the axes data, which varies depending on the plot type.
- `:rc_params`: The runtime configuration parameters.
- `:margin`: Specifies the margin of the figure.

## `M.show/1`
After creating a figure using the functions provided, call M.show/1 to generate and display the final SVG representation of the plot. The show/1 function will convert the Matplotex.Figure data into a valid SVG string.
## `M.show/1`
After creating a figure using the functions provided, call M.show/1 to generate and display the final SVG representation of the plot. The show/1 function will convert the Matplotex.Figure data into a valid SVG string.


"""
Expand Down Expand Up @@ -207,7 +207,6 @@ After creating a figure using the functions provided, call M.show/1 to generate
|> BarChart.create({pos, values, width}, opts)
end


@doc """
Creates a scatter plot based on the given `x` and `y` values, with optional customization provided via `opts`.

Expand Down Expand Up @@ -667,7 +666,6 @@ After creating a figure using the functions provided, call M.show/1 to generate

"""


def figure(figure, params) do
Figure.update_figure(figure, params)
end
Expand Down
9 changes: 5 additions & 4 deletions mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ defmodule Matplotex.MixProject do
def project do
[
app: :matplotex,

organization: :bigthinkcode,
version: "0.1.0",
elixir: "~> 1.17",
Expand All @@ -14,17 +13,18 @@ defmodule Matplotex.MixProject do
package: package()
]
end

defp package do
[
description: "A library for generating plots in Elixir.",
licenses: ["MIT"],
links: %{
"GitHub" => "https://github.com/bigthinkcode/matplotex"
},
maintainers: ["BigThinkCode", "Mohammed Sadique P", "Karthikeyan Mayilvahanam"],

maintainers: ["BigThinkCode", "Mohammed Sadique P", "Karthikeyan Mayilvahanam"]
]
end

defp elixirc_paths(:test), do: elixirc_paths(:dev) ++ ["test/support"]
defp elixirc_paths(_), do: ["lib"]

Expand All @@ -42,7 +42,8 @@ defmodule Matplotex.MixProject do
# {:dep_from_git, git: "https://github.com/elixir-lang/my_dep.git", tag: "0.1.0"}
{:csv, "~> 3.2"},
{:nx, "~> 0.7.3"},
{:dialyxir, "~> 1.4", only: [:dev, :test], runtime: false}
{:dialyxir, "~> 1.4", only: [:dev, :test], runtime: false},
{:ex_doc, "~> 0.34", only: :dev, runtime: false}
]
end
end
Loading