Defining plot types – bar, line, and stacked charts
In this recipe, we will present different basic plots and what are they used for. Most of the plots described here are used daily, and some of them present the basis for understanding more advanced concepts in data visualization.
Getting ready
We start with some common charts from the matplotlib.pyplot
library with just sample datasets; we start with basic charting and lay down the foundations of the following recipes.
How to do it...
We start by creating a simple plot in IPython. IPython is great because it allows us to interactively change plots and see the results immediately. You need to follow these steps for that:
Start IPython by typing the following code at the command prompt:
$ ipython
Import the necessary functions:
In [1]: from matplotlib.pyplot import *
Then type the matplotlib
plot
code:In [2]: plot([1,2,3,2,3,2,2,1]) Out[2]: [<matplotlib.lines.Line2D at 0x412fb50>]
The plot should open in a new window displaying the default...