Ask Your Question
1

Dashed edge of a polygon

asked 2021-04-26 17:57:09 +0200

Cyrille gravatar image

updated 2021-04-26 18:29:57 +0200

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 flag offensive close merge delete

Comments

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

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

1 Answer

Sort by ยป oldest newest most voted
0

answered 2021-04-26 23:52:29 +0200

slelievre gravatar image

updated 2021-05-04 10:08:43 +0200

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

Polygon with dashed edges


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.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2021-04-26 17:57:09 +0200

Seen: 57 times

Last updated: May 04