Skip to content

Commit

Permalink
added a handler for a spinespec attribute so the user can specify wha…
Browse files Browse the repository at this point in the history
…t spines to show in the layout document
  • Loading branch information
psilentp committed Jun 16, 2017
1 parent e7c551b commit af439ac
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
9 changes: 8 additions & 1 deletion figurefirst/mpl_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,12 @@ def kill_all_spines(layout):

def kill_all_labels(layout):
[kill_labels(ax) for ax in layout.axes.values()]


def set_spines(layout):
for ax in layout.axes.values():
if 'spinespec' in ax.__dict__:
adjust_spines(ax,ax.spinespec.split(','))

def set_fontsize(fig,fontsize):
"""
For each text object of a figure fig, set the font size to fontsize
Expand All @@ -123,6 +128,8 @@ def match(artist):
for textobj in fig.findobj(match=match):
textobj.set_fontsize(fontsize)



def fix_mpl_svg(file_path, pattern='miterlimit:100000;', subst='miterlimit:1;'):
"""used to fix problematic outputs from the matplotlib svg
generator, for example matplotlib creates exceptionaly large meterlimis"""
Expand Down
4 changes: 3 additions & 1 deletion figurefirst/svg_to_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -633,10 +633,12 @@ def traverse_axes(node,grouptree):
for mpl_methods_element in mpl_methods_elements:
[grouptree[ax.name].mplmethods.update({key:value}) for key,value in mpl_methods_element.attributes.items()]
projection = node.getElementsByTagName('figurefirst:projection')
if child.hasAttribute('figurefirst:projection'):#len(projection) == 0:
if child.hasAttribute('figurefirst:projection'):
grouptree[ax.name].projection = child.getAttribute('figurefirst:projection')
else:
grouptree[ax.name].projection = 'rectilinear'
if child.hasAttribute('figurefirst:spinespec'):
grouptree[ax.name].spinespec = child.getAttribute('figurefirst:spinespec')
if child.tagName in ['figurefirst:figure']:
if child.hasAttribute('figurefirst:template'):
fig = FFTemplateTarget(child)
Expand Down

0 comments on commit af439ac

Please sign in to comment.