1

Matplotlib seems to always draw a line plot in front of an alpha shaded region, whereas I want to achieve the opposite.

Minimal Example:

import matplotlib.pyplot as plt

plt.axhline(0.5, color="red")
plt.axvspan(0, 1, ymin=0, ymax=1, alpha=0.5)
plt.show()

The code above produces the image below. You can clearly see that the line is drawn in front of the alpha region.

A red line in front of a blue alpha shaded region

Is there a way to draw it behind the alpha region?

A-V Labs
  • 161
  • 1
  • 4

0 Answers0