I added several axvspan "highlights on my plot.
I'd like to change the properties of only one of those "highlights" such as
the facecolor, xmin, and xmax. I've included some code below. Lets say I'd
like to change the properties on the 2nd vertical highlight (axvspan).
Can someone please suggest some code on accessing and changing properties on
that specific object?
do I access it from the object "myhighlights" or do I access is from the
Note: This is just some simple code I came up with. My real application is
in a wx app GUI so I will be using the draw() function.
Here is my code:
import numpy as np
import matplotlib.pyplot as plt
t = np.arange(0, np.pi*2, 0.01)
x = np.sin(2*np.pi*t)
fig = plt.figure()
ax = fig.add_subplot(111)
myplot = ax.plot(t, x, 'b')
myhighlights = 
myhighlights.append(ax.axvspan(1,2, facecolor='g', alpha=0.2))
myhighlights.append(ax.axvspan(3,4, facecolor='g', alpha=0.2)) #later let's
change the facecolor, xmin, and xmax
myhighlights.append(ax.axvspan(5,6, facecolor='g', alpha=0.2))
#need code to change properties of the 2nd axvspan
#change facecolor to yellow
#change xmin to 3.5 and xmax to 4.5
Krishna Adrianto Pribadi
Harley-Davidson Motor Co.
Talladega Test Facility
Vehicle Test Stands
View this message in context: http://old.nabble.com/axvspan%2C-multiple-calls%2C-how-to-change-prop-of-1-object-instance-tp28219155p28219155.html
Sent from the matplotlib - users mailing list archive at Nabble.com.