Skip to content
Advertisement

matplotlib: draw a box on axes

JavaScript

I want to draw the box between y=75 and 90 (green and red lines on the chart), but nothing is shown up when I do ax.add_patch

this is the image I get:

enter image description here

So How do I fill out the area between red and green horizontal lines?

Advertisement

Answer

If you have a fixed area you want to fill and you want to do it across the entire chart, you are probably better off using axvspan. E.g.

JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement