# Dashed edge of a polygon

It seems that edges vould not be dashed

f = piecewise([((0, .4), 0), ([.4,1],1)] )
g = piecewise([((-0.001, 0), 1), ([0,0],.6), ((0,1),0.6), ([1,1],0)] )
pl=polygon([(0,0), (0,1), (1,1),(1,0)],rgbcolor=(0.75, 0.85,0.85),edgecolor="black",linestyle="dashed")
pl+=plot(f(x),(x,0,1), thickness=2,rgbcolor=(78.4, 3.1, 8.2))
pl+=plot(g(x),(x,-0.001,1), thickness=2, rgbcolor=(23,38.26,38.74),axes_labels=['$p$','$q$'], ticks=[[], []])
pl+=circle((0.4,0.6), .02, fill=True, edgecolor=(0.96, 0.97,0.46), rgbcolor=(0.96, 0.97, 0.46))
show(pl)

edit retag close merge delete

I had a problem in send ding the code. It's the reason of its bad formating

( 2021-04-26 17:58:41 +0200 )edit

Sort by ยป oldest newest most voted

This is not supported so far. This request is now tracked at:

As a workaround, plot the polygon using thickness=0 and the outline separately using line2d.

sage: vertices = [(0, 1), (1, 1), (1, 0)]
sage: pl = polygon2d(vertices, color=(0.75, 0.85, 0.85), thickness=0)
sage: pl += line2d(vertices + [vertices[0]], color='black', linestyle='--')
sage: pl


Edit. The ticket now has fix and positive review. Hopefully it will be part of some future Sage release.

If you installed Sage 9.2 or later from source or from binaries (rather than "via a package manager"), you can apply the fix to your current Sage installation by running the following commands in a terminal:

$cd$(sage -c "print(SAGE_ROOT)")
$git remote add trac git://trac.sagemath.org/sage.git -t develop$ git checkout -b 31734
$git pull trac u/chapoton/31734$ ./sage -b


Next time you start Sage, it should have the fix.

more