# How to Draw a Stack Plot

In this lesson, we will learn how to show the changes in a population over time by using stackplot.

## We'll cover the following

As we know that, the `pie`

chart is an effective way to show the proportion of individual pieces of data as they relate to the data overall. One drawback of such charts is that they only show the data of a given moment. They do not show how parts of a population change over time. We can use `stackplot`

to show how parts of the whole change over time.

`stackplot()`

is the basic function that Matplotlib provides to create a stack plot. Below are some of the important parameters required by the function:

`x`

: 1d array of dimension N`y`

: 2d array, dimension($M \times N$),or a sequence of arrays. Each dimension is $1 \times N$.`stackplot(x, y) stackplot(x, y1, y2, y3)`

`baseline`

: The method used to calculate the baseline.`zero`

a constant zero baseline, which is the default setting.`sym`

sets the plot symmetrically around zero.`wiggle`

minimizes the sum of the squared slopes.

`colors`

: Provides a list of colors for each data set.

Get hands-on with 1200+ tech skills courses.