Writing matplotlibrc on the fly for REFPROP plots

This commit is contained in:
Jorrit Wronski
2014-11-28 13:30:54 +01:00
parent 8a6c657d3e
commit 4f42f69ddd

View File

@@ -12,8 +12,6 @@ plots_path = os.path.join(web_dir,'fluid_properties','fluids','REFPROPplots')
template = """
from __future__ import division, print_function
import matplotlib
matplotlib.use('Agg') #Force mpl to use a non-GUI backend
import numpy as np, matplotlib.pyplot as plt
import CoolProp
@@ -72,9 +70,13 @@ plt.savefig(fluid+'.pdf')
plt.close('all')
"""
if not os.path.exists(plots_path):
os.makedirs(plots_path)
with open(os.path.join(plots_path, 'matplotlibrc'), 'w') as fp:
fp.write("backend : agg\n")
for fluid in CoolProp.__fluids__:
print('fluid:', fluid)
file_string = template.format(fluid = fluid)