How can I create some gradient color in matplotlib and then set the parameter axisbg of my subplot to this?
f = plt.figure()
ax = f.add_subplot(111, axisbg='green')
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
This doesn’t use the
axisbgparameter, but may do what you want.There’s a matplotlib example for gradients: http://matplotlib.sourceforge.net/examples/pylab_examples/gradient_bar.html.
I tried it myself, this simplified version gives me a green-white gradient background (for some reason when doing this in the interactive python shell I need to call
draw()in order for the image to show up):Pick another colormap for different gradients.
Works without
'bicubic'interpolation too, but it’s uglier then.