@@ -190,12 +190,23 @@ defmodule Matplotex do
190190 ```elixir
191191
192192 alias Matplotex as: M
193- categories = ["apple ", "banana ", "fig ", "avocado "]
193+ categories = ["lorem ", "ipsum ", "amet ", "adore "]
194194 values1 = [22, 33, 28, 34]
195195 iex> Matplotex.bar(width, values1, width, label: "Dataset1", color: "#255199")
196196 %M.Figure{axes: %M.Figure.Areal.BarChart{...}, ...}
197197 ```
198198
199+ - To draw a stacked bar chart
200+ ```elixir
201+ categories = ["lorem", "ipsum", "amet", "adore"]
202+ values1 = [22, 33, 28, 34]
203+ values2 = [12, 23, 18, 24]
204+ values3 = [22, 33, 28, 34]
205+ iex> Matplotex.bar(width, values1, width, label: "Dataset1", color: "#255199")
206+ |> Matplotex.bar(width, values2, width, label: "Dataset2", color: "blue", bottom: values1)
207+ |> Matplotex.bar(width, values3, width, label: "Dataset3", color: "green", bottom: [values1, values2])x
208+ ```
209+
199210 This function takes a list of numerical `values` and a single `width` value to create a bar chart where:
200211 - The height of each bar corresponds to its respective value from the list.
201212 - Each bar has the specified constant width.
0 commit comments