Skip to content

Commit 6436040

Browse files
author
Mohammed Sadique
committed
doc correct
1 parent 9f8ca7d commit 6436040

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

lib/matplotex.ex

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,6 @@ defmodule Matplotex do
176176
Generates a bar chart using the provided values and bar widths.
177177
178178
## Parameters
179-
180179
- `values` (list of numbers): A list of numerical values representing the heights of the bars in the chart.
181180
- `width` (floatiung point number): The width of each bar in inches.
182181
- `opts` (keyword list): It will support all opts mentioned above, some bar specific options are there those are
@@ -226,6 +225,11 @@ defmodule Matplotex do
226225
## Parameters
227226
228227
- `figure` (%Figure{}): The figure to which the new dataset will be added.
228+
- `pos` (floating point number) : In multi-dataset plots, the bar position is determined by a numerical offset.
229+
- Positive values shift the bar to the right of the tick.
230+
- Negative values shift the bar to the left of the tick.
231+
- Zero keeps the bar centered on the tick.
232+
This allows precise alignment and spacing between multiple datasets in a bar chart
229233
- `values` (list): A list of numerical values representing the heights of the bars in the new dataset.
230234
- `width` (float): The width of the bars in the dataset.
231235
- `opts` (keyword list, optional): A set of options for customizing the appearance of the new dataset, such as color and label.
@@ -240,10 +244,12 @@ defmodule Matplotex do
240244
categories = ["apple", "banana", "fig", "avocado"]
241245
values1 = [22, 33, 28, 34]
242246
values2 = [53, 63, 59, 60]
247+
values3 = [53, 63, 59, 60]
243248
width = 0.22
244249
245-
Matplotex.bar(width, values1, width, label: "Dataset1", color: "#255199")
246-
|> M.bar(width, values2, width, label: "Dataset2", color: "#D3D3D3")
250+
Matplotex.bar(-width, values1, width, label: "Dataset1", color: "#255199")
251+
|> M.bar(0, values2, width, label: "Dataset2", color: "#D3D3D3")
252+
|> M.bar(width, values2, width, label: "Dataset3", color: "green")
247253
"""
248254
def bar(%Figure{} = figure, pos, values, width, opts) do
249255
figure

0 commit comments

Comments
 (0)