Hi
I'm trying to shade a couple of areas of a plot I'm creating, I need
to shade the area above one line and the area below another.
According to the documentation it looks like I need to use the fill()
method but I can't get it to work, the code I use for creating the
plot is below:
# import required modules from matplotlib
import matplotlib
from matplotlib import figure
from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas
# set matplotlib plot parameters
matplotlib.rcParams.update({
"font.size": 8.0,
"axes.titlesize": 10.0,
"axes.labelsize": 10.0,
"xtick.labelsize": 8.0,
"ytick.labelsize": 8.0,
"legend.fontsize": 8.0,
"figure.dpi": 300,
"savefig.dpi": 300,
"text.usetex": True
})
def parameter_space_plot(options):
# setup figure
fig = figure.Figure()
FigureCanvas(fig)
fig.set_size_inches(5, 5)
axes = fig.gca()
axes.grid(True)
axes.set_xlabel("Mass 1 / $M_\odot$")
axes.set_ylabel("Mass 2 / $M_\odot$")
# setup mass array
mass = numpy.arange(0, options.max_mass + 1, 1)
# plot min/max mass lines
axes.plot(mass, minimum_mass(options, mass), 'b-')
axes.plot(mass, maximum_mass(options, mass), 'b-')
# plot equal mass line
axes.plot(mass, mass, 'k--')
# set axes limits
axes.set_xlim([0, options.max_mass])
axes.set_ylim([0, options.max_mass])
# return plot
return fig
could anyone give me pointers as to how I could shade the region of
the plot about the maximum mass line and the area below the minimum
mass line?
Cheers
Adam