Merge pull request #117 from flokno/fix_bandplot

FIX: bandplot | fix when `output_filename` is given
This commit is contained in:
Atsushi Togo 2020-05-05 10:24:24 +09:00 committed by GitHub
commit 6702af3045
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 4 deletions

View File

@ -204,6 +204,12 @@ def get_options():
return args
def savefig(plt, file, fonttype=42, family='serif'):
plt.rcParams['pdf.fonttype'] = fonttype
plt.rcParams['font.family'] = family
plt.savefig(file)
def old_plot(args):
if not args.is_gnuplot:
import matplotlib.pyplot as plt
@ -393,9 +399,7 @@ def old_plot(args):
plt.xlim(left=args.dos_min)
if args.output_filename is not None:
plt.rcParams['pdf.fonttype'] = 42
plt.rcParams['font.family'] = 'serif'
plt.savefig(args.output_filename)
savefig(plt, args.output_filename)
else:
plt.show()
@ -448,7 +452,10 @@ def plot(args):
for (l, p, f, d), fmt in zip(plots_data, fmts):
band_plot.plot(d, f, p, fmt=fmt)
plt.show()
if args.output_filename is not None:
savefig(plt, args.output_filename)
else:
plt.show()
def _get_max_frequency(frequencies):