I’ve been trying to set the linestyle of an ellipse with no success. I keep getting an attribute error whether I try setting the property via accessing the ellipse instance directly or through the artist. Any ideas?
–if you uncomment the line containing the linestyle you should see the error–just paste into ipython -pylab.
Cheers,
Brian
···
########################
from matplotlib.patches import Ellipse as E
plot_colors = [’#297AA3’,’#A3293D’,’#3B9DCE’,’#293DA3’,’#5229A3’,’#8F29A3’,’#A3297A’,
‘#7AA329’,’#3DA329’,’#29A352’,’#29A38F’,’#A38F29’,’#3B9DCE’,’#6CB6DA’,’#CE6C3B’,’#DA916C’,
‘#0080FF’,’#0000FF’,’#7ABDFF’,’#8000FF’,’#FF0080’,’#FF0000’,’#FF8000’,’#FFFF00’,’#A35229’,’#80FF00’,
‘#00FF00’,’#00FF80’,’#00FFFF’,’#3D9EFF’,’#FF9E3D’,’#FFBD7A’]
ells = []
for i in
xrange(3):
ells.append(E((i, i), 2, 2))
#ells.append(E((i, i), 1.9, 1.9, ls = ‘dashed’))
ells.append(E((i, i), 1.9, 1.9))
ells.append(E((i, i), 2.2, 2.2))
#Ellipse((x_loc, y_loc), prop_x, prop_y)
a = subplot(111, aspect=‘equal’)
for i,e in enumerate(ells):
e.set_clip_box(a.bbox)
e.set_alpha(0.1)
e.set_facecolor(plot_colors[i])
a.add_artist(e)
xlim(-2, 4)
ylim(-2, 4)
show()