Adding a shadow to the chart line
To be able to distinguish one particular plot line in the figure or just to fit in the overall style of the output our figure is in, we sometimes need to add a shadow effect to the chart line (or histogram, for that matter). In this recipe, you will be learning how to add a shadow effect to the plot's chart lines.
Getting ready
To add shadows to the lines or rectangles in our charts, we need to use the transformation framework built in matplotlib and located in matplotlib.transforms
.
To understand how it all works, we need to explain what transformations are available in matplotlib and how they work.
Transformations know how to convert the given coordinates from their coordinate system into display. They also know how to convert them from display coordinates into their own coordinate system.
The following table summarizes the existing coordinate systems and what they represent:
Coordinate system |
Transformation object |
Description |
---|---|---|
|
|
Represents... |