March 2014
Beginner to intermediate
222 pages
4h 7m
English
The pyplot.scatter() function has a built-in support for colormaps; some other plotting functions that we will discover later also have such support. However, some functions, such as pyplot.bar(), do not take colormaps as inputs to plot bar charts. In this recipe, we are going to see how to color a bar chart with a colormap.
matplotlib has helper functions to explicitly generate colors from a colormap. For instance, we can color the bars of a bar chart with the functions of the values they represent.
We will use the matplotlib.cm module in this recipe just as we did in the previous recipe. This time, we will directly use a colormap object rather than letting a rendering function use it automatically. ...
Read now
Unlock full access