Skip to content

Commit

Permalink
fixed whitespace parsing in mpl_functions.set_spines() and added spin…
Browse files Browse the repository at this point in the history
…e_spec example
  • Loading branch information
Theodore Lindsay authored and Theodore Lindsay committed Nov 23, 2017
1 parent b7e7f74 commit 89c10a4
Show file tree
Hide file tree
Showing 4 changed files with 144 additions and 6 deletions.
4 changes: 4 additions & 0 deletions examples/example_spine_spec.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import figurefirst as fifi
layout = fifi.FigureLayout('example_spine_spec_layout.svg',make_mplfigures = True)
fifi.mpl_functions.set_spines(layout)
layout.save('example_spine_spec_output.svg')
133 changes: 133 additions & 0 deletions examples/example_spine_spec_layout.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion figurefirst/mpl_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def kill_all_labels(layout):
def set_spines(layout):
for ax in layout.axes.values():
if 'spinespec' in ax.__dict__:
adjust_spines(ax,ax.spinespec.split(','))
adjust_spines(ax,[sp.strip() for sp in ax.spinespec.split(',')])

def set_fontsize(fig,fontsize):
"""
Expand Down
11 changes: 6 additions & 5 deletions figurefirst/svg_to_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -590,11 +590,12 @@ def __init__(self, layout_filename, autogenlayers=True,make_mplfigures = False,
print('Warning: key error - probably loading a layout with missing links, like missing figurefirst:template targets.')
#add the spinespecs
for ax in self.axes.values():
for node in ax.node.childNodes:
if node.nodeType == 1:
if node.tagName == 'figurefirst:spinespec':
ax.spinespec = node.getAttribute('figurefirst:spinelist')
#self.load_svgitems()
if not(ax.node is None):
for node in ax.node.childNodes:
if node.nodeType == 1:
if node.tagName == 'figurefirst:spinespec':
ax.spinespec = node.getAttribute('figurefirst:spinelist')
#self.load_svgitems()

# dont allow sx and sy to differ
# inkscape seems to ignore inconsistent aspect ratios by
Expand Down

0 comments on commit 89c10a4

Please sign in to comment.