Skip to content

Commit

Permalink
Added pdf option for large figures
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelClerx committed Aug 2, 2019
1 parent 5394b28 commit 211de51
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
8 changes: 6 additions & 2 deletions figures/f1-protocols/f1-protocols.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,16 @@
#
base = os.path.splitext(os.path.basename(__file__))[0]
args = sys.argv[1:]
if len(args) != 1:
print('Syntax: ' + base + '.py <cell>')
if len(args) not in (1, 2):
print('Syntax: ' + base + '.py <cell> (pdf)')
sys.exit(1)

if args[0] == 'all':
cell_list = range(1, 10)
else:
cell_list = [int(args[0])]
pdf = (len(args) > 1 and args[1] == 'pdf')


# Set font
font = {'family': 'arial', 'size': 10}
Expand Down Expand Up @@ -118,6 +120,8 @@ def mm(*size):
# Finalise
fig.subplots_adjust(0.055, 0.055, 0.985, 0.98)
fig.savefig(base + '-cell-' + str(cell) + '.png')
if pdf:
fig.savefig(base + '-cell-' + str(cell) + '.pdf')

#plt.show()

7 changes: 5 additions & 2 deletions figures/f6-cross-validation-3/f6-cross-validation-3.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,15 @@
#
base = os.path.splitext(os.path.basename(__file__))[0]
args = sys.argv[1:]
if len(args) != 1:
print('Syntax: ' + base + '.py <cell|all>')
if len(args) not in (1, 2):
print('Syntax: ' + base + '.py <cell|all> (pdf)')
sys.exit(1)

if args[0] == 'all':
cell_list = range(1, 10)
else:
cell_list = [int(args[0])]
pdf = (len(args) > 1 and args[1] == 'pdf')


# Set font
Expand Down Expand Up @@ -233,6 +234,8 @@ def mm(*size):

# Finalise
fig.savefig(base + '-cell-' + str(cell) + '.png')
if pdf:
fig.savefig(base + '-cell-' + str(cell) + '.pdf')

plt.close(fig)
del(fig, ax, grid1, grid2)
Expand Down

0 comments on commit 211de51

Please sign in to comment.