adds a separated module for plotting
This commit is contained in:
parent
4bbf0757ae
commit
3dadef14a4
2 changed files with 55 additions and 23 deletions
|
|
@ -138,29 +138,6 @@ class DumpTurtleLSystem(TurtleLSystem):
|
|||
return dump
|
||||
|
||||
|
||||
def plot_segments( segments ):
|
||||
|
||||
import matplotlib.pyplot as plot
|
||||
from matplotlib.path import Path
|
||||
import matplotlib.patches as patches
|
||||
|
||||
fig = plot.figure()
|
||||
ax = fig.add_subplot(111)
|
||||
|
||||
for segment in segments:
|
||||
start,end = segment
|
||||
verts = [start,end,(0,0)]
|
||||
codes = [Path.MOVETO,Path.LINETO,Path.STOP]
|
||||
path = Path(verts, codes)
|
||||
patch = patches.PathPatch(path, facecolor='none', lw=1)
|
||||
ax.add_patch(patch)
|
||||
|
||||
ax.set_xlim(-50,50)
|
||||
ax.set_ylim(-50,50)
|
||||
|
||||
plot.show()
|
||||
|
||||
|
||||
|
||||
if __name__=="__main__":
|
||||
import sys
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue