Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/jackson save the world #5

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,470 changes: 843 additions & 627 deletions HtmlPigeonListener.py

Large diffs are not rendered by default.

25 changes: 16 additions & 9 deletions Pigeon.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
# class to maintain pigeon script parsing and image generation
class Pigeon(object):

format = ''
format = ""
fig = plt.figure()

# if no image format is specified when you instantiate the class it will use the default svg format
def __init__(self, format='svg'):
def __init__(self, format="svg"):
self.format = format
pass

Expand All @@ -36,24 +36,31 @@ def parseAndGenerateImage(self, script_string):
design = HtmlPigeonListener.getDesignList(htmlPigeon)
arcs = HtmlPigeonListener.getArcList(htmlPigeon)

fig = plt.figure(figsize=(design.__len__()/3, 2))
fig = plt.figure(figsize=(design.__len__() / 3, 2))
gs = gridspec.GridSpec(1, 1)
axis = plt.subplot(gs[0])

print("Deisgn Length: " + str(design.__len__()))
print("Arcs Length: " + str(arcs.__len__()))

start, end = dr.renderDNA(axis, design, part_renderers, regs = arcs, reg_renderers=dr.std_reg_renderers(), plot_vector=htmlPigeon.has_vector, vector_label=htmlPigeon.vector_label)
start, end = dr.renderDNA(
axis,
design,
part_renderers,
regs=arcs,
reg_renderers=dr.std_reg_renderers(),
plot_vector=htmlPigeon.has_vector,
vector_label=htmlPigeon.vector_label,
)
axis.set_xlim([start, end])
axis.set_ylim([-(30 + design.__len__()), (30 + design.__len__())])
axis.set_aspect('equal')
axis.axis('off')
axis.set_aspect("equal")
axis.axis("off")
self.fig = fig
pass

# Saves Pigeon's fig using the function input values for name and location
def save(self, location, name):
save_path = location + name + '.' + self.format
self.fig.savefig(save_path, dpi=300) # Save as png file
save_path = location + name + "." + self.format
self.fig.savefig(save_path, dpi=300) # Save as png file
pass

Loading