I have a requirement to generate a scatter plot with the
> background divided into 4 equal rectangular regions, each
> a different colour/shade indicating a particular
> characteristic of the points in that region. What is the
> best way to do this in matplotlib?
Below is a script that shows one way to do it. If you don't like the
black border surrounding the different colored quadrants, you can set
the "edgecolor" property to be the same as the "facecolor"
Is this what you are looking for?
from pylab import *
# lower left quadrant
r1 = Rectangle( (0.0, 0.0), 5, 5, facecolor='yellow')
# lower right quadrant
r2 = Rectangle( (5.0, 0.0), 5, 5, facecolor='red')
# upper left quadrant
r3 = Rectangle( (0.0, 5.0), 5, 5, facecolor='blue')
# upper right quadrant
r4 = Rectangle( (5.0, 5.0), 5, 5, facecolor='green')
ax = subplot(111)
for r in (r1,r2,r3,r4):
axis([0, 10, 0, 10])