Set Ellipse Linestyle

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()

The example with the ls='dashed' uncommented works fine for me in svn
head, and according to the CHANGELOG, support for linestyle was added
in

  r5645 | jdh2358 | 2008-06-23 09:46:13 -0500 (Mon, 23 Jun 2008) | 1 line

  commited olle's linestyle patch patch

This predates the 0.98.3 release, which was released at svn r5947.
I'm not sure what version you are on, but "linestyle" should work on
the latest mpl release. If you are having trouble with "ls" on
0.98.3, see if "linestyle" works since it's possible support for the
alias was only added later.

JDH

···

On Sun, Nov 16, 2008 at 8:32 PM, B Clowers <clowersb@...9...> wrote:

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.