Hướng dẫn dùng pyplot stackplot python
View Discussion Improve Article Save Article View Discussion Improve Article Save Article Matplotlib is a visualization library available in Python. Pyplot contains various functions that help
matplotlib behave like MATLAB. It is used as matplotlib.pyplot for plotting figures, creating areas, lines, etc. Among so many functions provided by pyplot one is stackplot which will be discussed in this article. Stackplot is used to draw a stacked area plot. It displays the complete data for visualization. It shows each part stacked onto one another and how each part makes the complete figure. It displays various constituents of data and it behaves like a pie
chart. It has x-label, y-label, and title in which various parts can be represented by different colors. The idea of stack plots is to show “parts to the whole” over time. It is used to represent various datasets without overlapping over each other. Syntax: matplotlib.pyplot.stackplot(x, *args, labels=(), colors=None, baseline=’zero’, data=None, **kwargs) Example #1 : Using Stackplot Python3
Output: Example #2 : Using Stackplot Python3
Output: Below represents the output of graph if the value of baseline is set to sym Below represents the output of graph if the value of baseline is set to wiggle Below represents the output of graph if the value of baseline is set to weighted_wiggle Vote for difficulty Current difficulty : Basic |