Skip to content
All library documents

Manually Shading Recession Dates in MATLAB Charts

Article Quant Q&A · Author: Klapaucius

Summary

The document answers how to mark European crisis or recession periods on a MATLAB chart when the built-in recession plotting command is tied to official United States dates. It recommends adding the shaded interval manually, using an area plot behind the main data series and adapting the interval dates and color to the period of interest. The supplied example creates a bounded area, overlays a line plot, and sets axis limits, illustrating the basic layering approach.

This is a simple visualization technique rather than a method for identifying recession dates. The user must supply the dates independently, including any dates certified by the relevant European organization, and adjust the shaded bounds and styling to fit the chart. The answer also mentions that shading an area bounded by a curve may be useful in other contexts. It gives no guidance on importing recession chronology, handling multiple disjoint periods, or ensuring the shading aligns with date-based axes; those details would need to be adapted for a particular plot.

Key ideas

  • MATLAB users can mark non-US recession periods by manually shading the relevant date intervals.
  • An area plot can create the shaded region, with the data series drawn over it.
  • The interval bounds and styling must be adapted to the chronology and chart.
  • The example demonstrates basic layering but does not supply recession dates or a specialized plotting command.

Tags

Full text
# Matlab recessionplot


# Matlab recessionplot












I have seen that on matlab there is the cmd recessionplot that adds bar of recessions to plots. But that is for the official US dates, do you know if there is a similar command for the european crisis as certified by cepr?

## Answer by phdstudent (score 2)

https://quant.stackexchange.com/a/30750

You need to do it manually. Here's an example of shading an area behind a plot. You just need to adapt the colors and the dates for the recession.

A very basic example about shading an area in a plot. Shading an area bounded by a curve might be of interest as well.

```
figure;
ha = area([4 6], [10 10]);
hold on
plot(1:10, 1:10,'r')
axis([1 10 1 10])
hold off
```

Shown in full with attribution under the source's licence. Licence: CC BY-SA 4.0 (Stack Exchange)

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.