From 95cdbdc90c9d1d2e20da70c7623f19cec728b250 Mon Sep 17 00:00:00 2001 From: Johanna Huck Date: Tue, 26 May 2015 21:57:27 -0700 Subject: [PATCH 01/20] start dftplots examples --- ccsgp_get_started/dftplots/README.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 ccsgp_get_started/dftplots/README.md diff --git a/ccsgp_get_started/dftplots/README.md b/ccsgp_get_started/dftplots/README.md new file mode 100644 index 0000000..92e88db --- /dev/null +++ b/ccsgp_get_started/dftplots/README.md @@ -0,0 +1,3 @@ +### DFTplots + +scripts to generate plots for DFT benchmarking paper From 28cbd44f43e3f527ec4b6a7a7d861c29e21e2013 Mon Sep 17 00:00:00 2001 From: Johanna Huck Date: Tue, 16 Jun 2015 16:13:19 -0700 Subject: [PATCH 02/20] initial commit for dftplots --- ccsgp_get_started/dftplots/__init__.py | 0 ccsgp_get_started/dftplots/gp_bindenergy.py | 87 +++++++++++++++++++++ 2 files changed, 87 insertions(+) create mode 100644 ccsgp_get_started/dftplots/__init__.py create mode 100644 ccsgp_get_started/dftplots/gp_bindenergy.py diff --git a/ccsgp_get_started/dftplots/__init__.py b/ccsgp_get_started/dftplots/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/ccsgp_get_started/dftplots/gp_bindenergy.py b/ccsgp_get_started/dftplots/gp_bindenergy.py new file mode 100644 index 0000000..4080056 --- /dev/null +++ b/ccsgp_get_started/dftplots/gp_bindenergy.py @@ -0,0 +1,87 @@ +import logging, argparse, os, sys +import numpy as np +from collections import OrderedDict +from ..ccsgp.ccsgp import make_plot +from ..examples.utils import getWorkDirs +from ..ccsgp.utils import getOpts + +def gp_bindenergy(guest): + """example for plotting from a text file via numpy.loadtxt + + 1. prepare input/output directories + 2. load the data into an OrderedDict() [adjust axes units] + 3. sort countries from highest to lowest population + 4. select the most populated countries + 5. call ccsgp.make_plot with data from 4 + + Below is an output image for country initial T and the 4 most populated + countries for this initial (click to enlarge). Also see:: + + $ python -m ccsgp_get_started.examples.gp_datdir -h + + for help on the command line options. + + .. image:: pics/T.png + :width: 450 px + + .. image:: pics/U.png + :width: 450 px + + :param initial: country initial + :type initial: str + :param topN: number of most populated countries to plot + :type topN: int + :ivar inDir: input directory according to package structure and initial + :ivar outDir: output directory according to package structure + :ivar data: OrderedDict with datasets to plot as separate keys + :ivar file: data input file for specific country, format: [x y] OR [x y dx dy] + :ivar country: country, filename stem of input file + :ivar file_url: absolute url to input file + :ivar nSets: number of datasets + """ + # prepare input/output directories + inDir, outDir = getWorkDirs() + guest = guest.capitalize() + inDir = os.path.join(inDir, guest) + if not os.path.exists(inDir): # catch missing initial + return "guest %s doesn't exist" % guest + # prepare data + data = OrderedDict() + for file in os.listdir(inDir): + funct = os.path.splitext(file)[0] + file_url = os.path.join(inDir, file) + data[funct] = np.loadtxt(open(file_url, 'rb')) # load data + if data[funct].shape[1] > 2: data[funct][:, 3:] /= 1e6 + logging.debug(data) # shown if --log flag given on command line + # sort countries according to mean population (highest -> lowest) + sorted_data = OrderedDict(sorted( + data.items(), key = lambda t: np.mean(t[1][:,1]), reverse = True + )) + # # "pop" (select) N most populated countries + # top_data = OrderedDict( + # sorted_data.popitem(last = False) for i in xrange(topN) + # if sorted_data + # ) + # generate plot using ccsgp.make_plot + nSets = len(data) + make_plot( + data = data.values(), + properties = [ getOpts(i) for i in xrange(nSets) ], + titles = data.keys(), # use data keys as legend titles + name = os.path.join(outDir, guest), + key = [ 'at graph 1., 1.2', 'maxrows 2' ], + ylabel = 'binding energy (kJ/mol)', + xlabel = 'metals', rmargin = 0.99, tmargin = 0.85, size='8.5in,8in' + ) + return 'done' + +if __name__ == '__main__': + parser = argparse.ArgumentParser() + parser.add_argument("guest", help="guest = input subdir with txt files") + parser.add_argument("--log", help="show log output", action="store_true") + args = parser.parse_args() + loglevel = 'DEBUG' if args.log else 'WARNING' + logging.basicConfig( + format='%(message)s', level=getattr(logging, loglevel) + ) + print gp_bindenergy(args.guest) From 64a1023452387738fb8a172bbbd044b9819ec465 Mon Sep 17 00:00:00 2001 From: Johanna Huck Date: Tue, 16 Jun 2015 16:28:16 -0700 Subject: [PATCH 03/20] delete all gp_datadir leftover defs --- ccsgp_get_started/dftplots/gp_bindenergy.py | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/ccsgp_get_started/dftplots/gp_bindenergy.py b/ccsgp_get_started/dftplots/gp_bindenergy.py index 4080056..b1bbae0 100644 --- a/ccsgp_get_started/dftplots/gp_bindenergy.py +++ b/ccsgp_get_started/dftplots/gp_bindenergy.py @@ -51,17 +51,7 @@ def gp_bindenergy(guest): funct = os.path.splitext(file)[0] file_url = os.path.join(inDir, file) data[funct] = np.loadtxt(open(file_url, 'rb')) # load data - if data[funct].shape[1] > 2: data[funct][:, 3:] /= 1e6 logging.debug(data) # shown if --log flag given on command line - # sort countries according to mean population (highest -> lowest) - sorted_data = OrderedDict(sorted( - data.items(), key = lambda t: np.mean(t[1][:,1]), reverse = True - )) - # # "pop" (select) N most populated countries - # top_data = OrderedDict( - # sorted_data.popitem(last = False) for i in xrange(topN) - # if sorted_data - # ) # generate plot using ccsgp.make_plot nSets = len(data) make_plot( From 3b01f97c980f9618954e1ccfd35b71f73dace583 Mon Sep 17 00:00:00 2001 From: Johanna Huck Date: Tue, 16 Jun 2015 16:45:02 -0700 Subject: [PATCH 04/20] update pydocs to match script --- ccsgp_get_started/dftplots/gp_bindenergy.py | 23 ++++++--------------- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/ccsgp_get_started/dftplots/gp_bindenergy.py b/ccsgp_get_started/dftplots/gp_bindenergy.py index b1bbae0..3e9a360 100644 --- a/ccsgp_get_started/dftplots/gp_bindenergy.py +++ b/ccsgp_get_started/dftplots/gp_bindenergy.py @@ -10,32 +10,21 @@ def gp_bindenergy(guest): 1. prepare input/output directories 2. load the data into an OrderedDict() [adjust axes units] - 3. sort countries from highest to lowest population - 4. select the most populated countries - 5. call ccsgp.make_plot with data from 4 + 3. call ccsgp.make_plot with data from 4 - Below is an output image for country initial T and the 4 most populated - countries for this initial (click to enlarge). Also see:: + Also see:: - $ python -m ccsgp_get_started.examples.gp_datdir -h + $ python -m ccsgp_get_started.dftplots.gp_bindenergy -h for help on the command line options. - .. image:: pics/T.png - :width: 450 px - - .. image:: pics/U.png - :width: 450 px - - :param initial: country initial - :type initial: str - :param topN: number of most populated countries to plot - :type topN: int + :param guest: guest molecule + :type guest: str :ivar inDir: input directory according to package structure and initial :ivar outDir: output directory according to package structure :ivar data: OrderedDict with datasets to plot as separate keys :ivar file: data input file for specific country, format: [x y] OR [x y dx dy] - :ivar country: country, filename stem of input file + :ivar funct: functional, filename stem of input file :ivar file_url: absolute url to input file :ivar nSets: number of datasets """ From bf349774338dcfbf24154ec51065ec6bae57390a Mon Sep 17 00:00:00 2001 From: Johanna Huck Date: Tue, 16 Jun 2015 16:56:04 -0700 Subject: [PATCH 05/20] 2. update pydocs to match script --- ccsgp_get_started/dftplots/gp_bindenergy.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/ccsgp_get_started/dftplots/gp_bindenergy.py b/ccsgp_get_started/dftplots/gp_bindenergy.py index 3e9a360..c424040 100644 --- a/ccsgp_get_started/dftplots/gp_bindenergy.py +++ b/ccsgp_get_started/dftplots/gp_bindenergy.py @@ -10,7 +10,7 @@ def gp_bindenergy(guest): 1. prepare input/output directories 2. load the data into an OrderedDict() [adjust axes units] - 3. call ccsgp.make_plot with data from 4 + 3. call ccsgp.make_plot with data from 2 Also see:: @@ -20,19 +20,18 @@ def gp_bindenergy(guest): :param guest: guest molecule :type guest: str - :ivar inDir: input directory according to package structure and initial + :ivar inDir: input directory according to package structure and guest :ivar outDir: output directory according to package structure :ivar data: OrderedDict with datasets to plot as separate keys - :ivar file: data input file for specific country, format: [x y] OR [x y dx dy] + :ivar file: data input file for specific guest, format: [x y] OR [x y dx dy] :ivar funct: functional, filename stem of input file :ivar file_url: absolute url to input file :ivar nSets: number of datasets """ # prepare input/output directories inDir, outDir = getWorkDirs() - guest = guest.capitalize() inDir = os.path.join(inDir, guest) - if not os.path.exists(inDir): # catch missing initial + if not os.path.exists(inDir): # catch missing guest return "guest %s doesn't exist" % guest # prepare data data = OrderedDict() From 41b818e356e415b9d043d413fe5d34842a57329c Mon Sep 17 00:00:00 2001 From: Johanna Huck Date: Wed, 17 Jun 2015 16:21:43 -0700 Subject: [PATCH 06/20] include bars, boxwidth and color fill --- ccsgp_get_started/dftplots/gp_bindenergy.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ccsgp_get_started/dftplots/gp_bindenergy.py b/ccsgp_get_started/dftplots/gp_bindenergy.py index c424040..ac12443 100644 --- a/ccsgp_get_started/dftplots/gp_bindenergy.py +++ b/ccsgp_get_started/dftplots/gp_bindenergy.py @@ -4,6 +4,7 @@ from ..ccsgp.ccsgp import make_plot from ..examples.utils import getWorkDirs from ..ccsgp.utils import getOpts +from ..ccsgp.config import default_colors def gp_bindenergy(guest): """example for plotting from a text file via numpy.loadtxt @@ -44,12 +45,14 @@ def gp_bindenergy(guest): nSets = len(data) make_plot( data = data.values(), - properties = [ getOpts(i) for i in xrange(nSets) ], + properties = [ 'with boxes lc %s' % (default_colors[1])], + gpcalls = [ 'boxwidth 0.2 absolute', 'style fill solid 1.0 border lt -1'], titles = data.keys(), # use data keys as legend titles name = os.path.join(outDir, guest), key = [ 'at graph 1., 1.2', 'maxrows 2' ], ylabel = 'binding energy (kJ/mol)', - xlabel = 'metals', rmargin = 0.99, tmargin = 0.85, size='8.5in,8in' + xlabel = 'metals', rmargin = 0.99, tmargin = 0.85, size='8.5in,8in', + debug = True ) return 'done' From 3fa9fb68b8bcdf0a50ef587ed17cced26444e46a Mon Sep 17 00:00:00 2001 From: Johanna Huck Date: Tue, 23 Jun 2015 16:18:35 -0700 Subject: [PATCH 07/20] plot set in diff. colored bars & change xtics to match metal --- ccsgp_get_started/dftplots/gp_bindenergy.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ccsgp_get_started/dftplots/gp_bindenergy.py b/ccsgp_get_started/dftplots/gp_bindenergy.py index ac12443..763f3a2 100644 --- a/ccsgp_get_started/dftplots/gp_bindenergy.py +++ b/ccsgp_get_started/dftplots/gp_bindenergy.py @@ -45,8 +45,10 @@ def gp_bindenergy(guest): nSets = len(data) make_plot( data = data.values(), - properties = [ 'with boxes lc %s' % (default_colors[1])], - gpcalls = [ 'boxwidth 0.2 absolute', 'style fill solid 1.0 border lt -1'], + properties = [ 'with boxes lc %s' % (default_colors[i]) for i in + range(nSets)], + gpcalls = [ 'boxwidth 0.2 absolute', 'style fill solid 1.0 border lt 0', + 'xtics ("Mg"1, "Mn"2, "Fe"3, "Co"4, "Ni"5, "Cu"6, "Zn"7)'], titles = data.keys(), # use data keys as legend titles name = os.path.join(outDir, guest), key = [ 'at graph 1., 1.2', 'maxrows 2' ], From 2bb2e3d4f8d450a6a33ef1c5de163abf40d0300b Mon Sep 17 00:00:00 2001 From: Johanna Huck Date: Tue, 23 Jun 2015 16:19:13 -0700 Subject: [PATCH 08/20] change size of key to fit funct. names --- ccsgp_get_started/dftplots/gp_bindenergy.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ccsgp_get_started/dftplots/gp_bindenergy.py b/ccsgp_get_started/dftplots/gp_bindenergy.py index 763f3a2..040d06f 100644 --- a/ccsgp_get_started/dftplots/gp_bindenergy.py +++ b/ccsgp_get_started/dftplots/gp_bindenergy.py @@ -51,7 +51,7 @@ def gp_bindenergy(guest): 'xtics ("Mg"1, "Mn"2, "Fe"3, "Co"4, "Ni"5, "Cu"6, "Zn"7)'], titles = data.keys(), # use data keys as legend titles name = os.path.join(outDir, guest), - key = [ 'at graph 1., 1.2', 'maxrows 2' ], + key = [ 'at graph 1., 1.2', 'maxrows 2', 'width -1.05' ], ylabel = 'binding energy (kJ/mol)', xlabel = 'metals', rmargin = 0.99, tmargin = 0.85, size='8.5in,8in', debug = True From 6839e81310e1caf58415b767c5b8e1a3505ed795 Mon Sep 17 00:00:00 2001 From: Johanna Huck Date: Wed, 24 Jun 2015 13:54:18 -0700 Subject: [PATCH 09/20] fix bw shift, box lt & reverse axis --- ccsgp_get_started/dftplots/gp_bindenergy.py | 24 +++++++++++++++------ 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/ccsgp_get_started/dftplots/gp_bindenergy.py b/ccsgp_get_started/dftplots/gp_bindenergy.py index 040d06f..73584be 100644 --- a/ccsgp_get_started/dftplots/gp_bindenergy.py +++ b/ccsgp_get_started/dftplots/gp_bindenergy.py @@ -36,21 +36,31 @@ def gp_bindenergy(guest): return "guest %s doesn't exist" % guest # prepare data data = OrderedDict() - for file in os.listdir(inDir): + files = os.listdir(inDir) + nfiles = len(files) + dx = 0.7/nfiles + gap = (1. - dx*nfiles)/2 + for idx,file in enumerate(files): funct = os.path.splitext(file)[0] file_url = os.path.join(inDir, file) data[funct] = np.loadtxt(open(file_url, 'rb')) # load data + data[funct][:,0] += (idx - nfiles/2 + 0.5*(not nfiles%2)) * dx logging.debug(data) # shown if --log flag given on command line # generate plot using ccsgp.make_plot nSets = len(data) make_plot( data = data.values(), - properties = [ 'with boxes lc %s' % (default_colors[i]) for i in - range(nSets)], - gpcalls = [ 'boxwidth 0.2 absolute', 'style fill solid 1.0 border lt 0', - 'xtics ("Mg"1, "Mn"2, "Fe"3, "Co"4, "Ni"5, "Cu"6, "Zn"7)'], - titles = data.keys(), # use data keys as legend titles - name = os.path.join(outDir, guest), + properties = [ + 'with boxes lt -1 lc %s' % (default_colors[i]) for i in range(nSets) + ], gpcalls = [ + 'boxwidth {} absolute'.format(dx), + 'style fill solid 1.0 border lt -1', + 'xtics ("Mg"1, "Mn"2, "Fe"3, "Co"4, "Ni"5, "Cu"6, "Zn"7)', + #'object 51 rectangle back fc rgb "grey" from {},0 to {},-60'.format( + # 1.5 + gap, 2.5 - gap + #), + ], titles = data.keys(), # use data keys as legend titles + name = os.path.join(outDir, guest), yreverse = True, key = [ 'at graph 1., 1.2', 'maxrows 2', 'width -1.05' ], ylabel = 'binding energy (kJ/mol)', xlabel = 'metals', rmargin = 0.99, tmargin = 0.85, size='8.5in,8in', From 02b3a300593fcb790a5c3983219b1178a27e70d7 Mon Sep 17 00:00:00 2001 From: Johanna Huck Date: Thu, 25 Jun 2015 10:54:33 -0700 Subject: [PATCH 10/20] change x-axis label --- ccsgp_get_started/dftplots/gp_bindenergy.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ccsgp_get_started/dftplots/gp_bindenergy.py b/ccsgp_get_started/dftplots/gp_bindenergy.py index 73584be..a8467f0 100644 --- a/ccsgp_get_started/dftplots/gp_bindenergy.py +++ b/ccsgp_get_started/dftplots/gp_bindenergy.py @@ -62,7 +62,7 @@ def gp_bindenergy(guest): ], titles = data.keys(), # use data keys as legend titles name = os.path.join(outDir, guest), yreverse = True, key = [ 'at graph 1., 1.2', 'maxrows 2', 'width -1.05' ], - ylabel = 'binding energy (kJ/mol)', + ylabel = 'electronic binding energy (kJ/mol)', xlabel = 'metals', rmargin = 0.99, tmargin = 0.85, size='8.5in,8in', debug = True ) From 1f0746e7a7e388729f8b6af2c02be60c06e05147 Mon Sep 17 00:00:00 2001 From: Johanna Huck Date: Fri, 26 Jun 2015 16:18:30 -0700 Subject: [PATCH 11/20] add colorscale array for bars --- ccsgp_get_started/dftplots/gp_bindenergy.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/ccsgp_get_started/dftplots/gp_bindenergy.py b/ccsgp_get_started/dftplots/gp_bindenergy.py index a8467f0..20f56b3 100644 --- a/ccsgp_get_started/dftplots/gp_bindenergy.py +++ b/ccsgp_get_started/dftplots/gp_bindenergy.py @@ -3,7 +3,7 @@ from collections import OrderedDict from ..ccsgp.ccsgp import make_plot from ..examples.utils import getWorkDirs -from ..ccsgp.utils import getOpts +from ..ccsgp.utils import getOpts, colorscale from ..ccsgp.config import default_colors def gp_bindenergy(guest): @@ -28,7 +28,16 @@ def gp_bindenergy(guest): :ivar funct: functional, filename stem of input file :ivar file_url: absolute url to input file :ivar nSets: number of datasets + :ivar nfiles: number of files + :ivar dx: bar width + :ivar gap: gap between 2 bars """ + # prepare color arrays for dataset + my_color_set = [default_colors[i] for i in range(0, 3)] + my_color_array = [] + for color in my_color_set: + my_color_array.append(colorscale(color[-7:-1], 0.8)) + my_color_array.append(colorscale(color[-7:-1], 1.5)) # prepare input/output directories inDir, outDir = getWorkDirs() inDir = os.path.join(inDir, guest) @@ -42,6 +51,7 @@ def gp_bindenergy(guest): gap = (1. - dx*nfiles)/2 for idx,file in enumerate(files): funct = os.path.splitext(file)[0] + if funct == 'experiments': continue file_url = os.path.join(inDir, file) data[funct] = np.loadtxt(open(file_url, 'rb')) # load data data[funct][:,0] += (idx - nfiles/2 + 0.5*(not nfiles%2)) * dx @@ -51,7 +61,7 @@ def gp_bindenergy(guest): make_plot( data = data.values(), properties = [ - 'with boxes lt -1 lc %s' % (default_colors[i]) for i in range(nSets) + 'with boxes lt -1 lc %s' % (my_color_array[i]) for i in range(nSets) ], gpcalls = [ 'boxwidth {} absolute'.format(dx), 'style fill solid 1.0 border lt -1', From a537d1b48e817c4e9d7a4925e6a2df0aaa034963 Mon Sep 17 00:00:00 2001 From: Johanna Huck Date: Tue, 30 Jun 2015 22:38:30 -0700 Subject: [PATCH 12/20] gp_bindenergy: include experiments --- ccsgp_get_started/dftplots/gp_bindenergy.py | 35 +++++++++++---------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/ccsgp_get_started/dftplots/gp_bindenergy.py b/ccsgp_get_started/dftplots/gp_bindenergy.py index 20f56b3..2c17051 100644 --- a/ccsgp_get_started/dftplots/gp_bindenergy.py +++ b/ccsgp_get_started/dftplots/gp_bindenergy.py @@ -29,15 +29,15 @@ def gp_bindenergy(guest): :ivar file_url: absolute url to input file :ivar nSets: number of datasets :ivar nfiles: number of files - :ivar dx: bar width - :ivar gap: gap between 2 bars + :ivar dx: bar width estimated for specific amount of datasets + :ivar gap: space between 2 bars """ # prepare color arrays for dataset - my_color_set = [default_colors[i] for i in range(0, 3)] + my_color_set = [default_colors[i] for i in range(0, 4)] my_color_array = [] for color in my_color_set: my_color_array.append(colorscale(color[-7:-1], 0.8)) - my_color_array.append(colorscale(color[-7:-1], 1.5)) + my_color_array.append(colorscale(color[-7:-1], 1.4)) # prepare input/output directories inDir, outDir = getWorkDirs() inDir = os.path.join(inDir, guest) @@ -46,34 +46,37 @@ def gp_bindenergy(guest): # prepare data data = OrderedDict() files = os.listdir(inDir) - nfiles = len(files) + nfiles = len(files)-1 dx = 0.7/nfiles gap = (1. - dx*nfiles)/2 for idx,file in enumerate(files): - funct = os.path.splitext(file)[0] - if funct == 'experiments': continue + funct, ext = os.path.splitext(file) + if funct == 'experiments' or ext != '.dat': continue file_url = os.path.join(inDir, file) data[funct] = np.loadtxt(open(file_url, 'rb')) # load data - data[funct][:,0] += (idx - nfiles/2 + 0.5*(not nfiles%2)) * dx + data[funct][:,0] += (idx - (nfiles+1)/2. + 0.5*(not nfiles%2)) * dx + data['M06-L'] = data.pop('M06-L') + exp_data = np.loadtxt(open(os.path.join(inDir,'experiments.dat'), 'rb')) # load exp_data logging.debug(data) # shown if --log flag given on command line # generate plot using ccsgp.make_plot nSets = len(data) make_plot( - data = data.values(), - properties = [ + data = [np.array([[1,-5]])] + data.values(), + properties = ['with boxes lt -1 lc %s' % default_colors[-10]] + [ 'with boxes lt -1 lc %s' % (my_color_array[i]) for i in range(nSets) ], gpcalls = [ 'boxwidth {} absolute'.format(dx), 'style fill solid 1.0 border lt -1', 'xtics ("Mg"1, "Mn"2, "Fe"3, "Co"4, "Ni"5, "Cu"6, "Zn"7)', - #'object 51 rectangle back fc rgb "grey" from {},0 to {},-60'.format( - # 1.5 + gap, 2.5 - gap - #), - ], titles = data.keys(), # use data keys as legend titles + ] + [ + 'arrow {} from {},{} to {},{} lw 4 lc {} nohead front'.format( + i+5, dp[0]-nfiles*dx/2., dp[1], dp[0]+nfiles*dx/2., dp[1], default_colors[-10] + ) for i,dp in enumerate(exp_data) + ], titles = ['experiments'] + data.keys(), # use data keys as legend titles name = os.path.join(outDir, guest), yreverse = True, - key = [ 'at graph 1., 1.2', 'maxrows 2', 'width -1.05' ], + key = [ 'at graph 1.07, 1.25', 'maxrows 3', 'width -1.1', 'nobox' ], ylabel = 'electronic binding energy (kJ/mol)', - xlabel = 'metals', rmargin = 0.99, tmargin = 0.85, size='8.5in,8in', + xlabel = 'metals', rmargin = 0.99, tmargin = 0.83, size='8.5in,8in', debug = True ) return 'done' From 419bd7fc2ccf5bbff718dc13d98150b52b258b8d Mon Sep 17 00:00:00 2001 From: Johanna Huck Date: Wed, 1 Jul 2015 00:14:34 -0700 Subject: [PATCH 13/20] gp_bindenergy: first version of panel plot --- ccsgp_get_started/dftplots/gp_bindenergy.py | 90 ++++++++++++--------- 1 file changed, 53 insertions(+), 37 deletions(-) diff --git a/ccsgp_get_started/dftplots/gp_bindenergy.py b/ccsgp_get_started/dftplots/gp_bindenergy.py index 2c17051..2545771 100644 --- a/ccsgp_get_started/dftplots/gp_bindenergy.py +++ b/ccsgp_get_started/dftplots/gp_bindenergy.py @@ -1,7 +1,7 @@ import logging, argparse, os, sys import numpy as np from collections import OrderedDict -from ..ccsgp.ccsgp import make_plot +from ..ccsgp.ccsgp import make_panel from ..examples.utils import getWorkDirs from ..ccsgp.utils import getOpts, colorscale from ..ccsgp.config import default_colors @@ -11,7 +11,7 @@ def gp_bindenergy(guest): 1. prepare input/output directories 2. load the data into an OrderedDict() [adjust axes units] - 3. call ccsgp.make_plot with data from 2 + 3. call ccsgp.make_panel with data from 2 Also see:: @@ -27,16 +27,16 @@ def gp_bindenergy(guest): :ivar file: data input file for specific guest, format: [x y] OR [x y dx dy] :ivar funct: functional, filename stem of input file :ivar file_url: absolute url to input file - :ivar nSets: number of datasets :ivar nfiles: number of files :ivar dx: bar width estimated for specific amount of datasets :ivar gap: space between 2 bars """ # prepare color arrays for dataset - my_color_set = [default_colors[i] for i in range(0, 4)] + my_color_set = [default_colors[3]] + [default_colors[i] for i in range(0, 3)] my_color_array = [] - for color in my_color_set: + for icol,color in enumerate(my_color_set): my_color_array.append(colorscale(color[-7:-1], 0.8)) + if icol == 0: continue my_color_array.append(colorscale(color[-7:-1], 1.4)) # prepare input/output directories inDir, outDir = getWorkDirs() @@ -44,40 +44,56 @@ def gp_bindenergy(guest): if not os.path.exists(inDir): # catch missing guest return "guest %s doesn't exist" % guest # prepare data - data = OrderedDict() - files = os.listdir(inDir) - nfiles = len(files)-1 + dpt_dict = OrderedDict() + dpt_dict['absolute'] = [[], [], []] #dpt + # exp-data + exp_data = np.loadtxt(open(os.path.join(inDir,'experiments.dat'), 'rb')) # load exp_data + dpt_dict['absolute'][0].append(np.array([[1,-5]])) + dpt_dict['absolute'][1].append('with boxes lt -1 lc %s' % default_colors[-10]) + dpt_dict['absolute'][2].append('experiments') + # sim-data + files = [ + os.path.join(inDir, funct+ext) + for funct,ext in map(os.path.splitext, os.listdir(inDir)) + if funct != 'experiments' and ext == '.dat' + ] + nfiles = len(files) dx = 0.7/nfiles gap = (1. - dx*nfiles)/2 - for idx,file in enumerate(files): - funct, ext = os.path.splitext(file) - if funct == 'experiments' or ext != '.dat': continue - file_url = os.path.join(inDir, file) - data[funct] = np.loadtxt(open(file_url, 'rb')) # load data - data[funct][:,0] += (idx - (nfiles+1)/2. + 0.5*(not nfiles%2)) * dx - data['M06-L'] = data.pop('M06-L') - exp_data = np.loadtxt(open(os.path.join(inDir,'experiments.dat'), 'rb')) # load exp_data - logging.debug(data) # shown if --log flag given on command line - # generate plot using ccsgp.make_plot - nSets = len(data) - make_plot( - data = [np.array([[1,-5]])] + data.values(), - properties = ['with boxes lt -1 lc %s' % default_colors[-10]] + [ - 'with boxes lt -1 lc %s' % (my_color_array[i]) for i in range(nSets) - ], gpcalls = [ - 'boxwidth {} absolute'.format(dx), - 'style fill solid 1.0 border lt -1', - 'xtics ("Mg"1, "Mn"2, "Fe"3, "Co"4, "Ni"5, "Cu"6, "Zn"7)', - ] + [ - 'arrow {} from {},{} to {},{} lw 4 lc {} nohead front'.format( - i+5, dp[0]-nfiles*dx/2., dp[1], dp[0]+nfiles*dx/2., dp[1], default_colors[-10] - ) for i,dp in enumerate(exp_data) - ], titles = ['experiments'] + data.keys(), # use data keys as legend titles - name = os.path.join(outDir, guest), yreverse = True, - key = [ 'at graph 1.07, 1.25', 'maxrows 3', 'width -1.1', 'nobox' ], - ylabel = 'electronic binding energy (kJ/mol)', - xlabel = 'metals', rmargin = 0.99, tmargin = 0.83, size='8.5in,8in', - debug = True + for idx,file_url in enumerate(files): + funct = os.path.splitext(os.path.basename(file_url))[0] + data_import = np.loadtxt(open(file_url, 'rb')) # load data + data_import[:,0] += (idx - nfiles/2. + 0.5*(not nfiles%2)) * dx + dpt_dict['absolute'][0].append(data_import) + dpt_dict['absolute'][1].append('with boxes lt -1 lc %s' % my_color_array[idx]) + dpt_dict['absolute'][2].append(funct) + # relative differences + dpt_dict['relative difference'] = [[], [], []] #dpt + for idx,d in enumerate(dpt_dict['absolute'][0][1:]): + diff = np.copy(d) + exp_data_mod = exp_data if idx != 0 else exp_data[(0,6),:] + diff[:,1] /= -exp_data_mod[:,1] + diff[:,1] += 1. + dpt_dict['relative difference'][0].append(diff) + dpt_dict['relative difference'][1].append('with boxes lt -1 lc %s' % my_color_array[idx]) + dpt_dict['relative difference'][2].append(dpt_dict['absolute'][2][idx+1]) + logging.debug(dpt_dict) # shown if --log flag given on command line + # generate plot using ccsgp.make_panel + make_panel( + dpt_dict = dpt_dict, + gpcalls = [ + 'boxwidth {} absolute'.format(dx), + 'style fill solid 1.0 border lt -1', + 'xtics ("Mg"1, "Mn"2, "Fe"3, "Co"4, "Ni"5, "Cu"6, "Zn"7)', + ] + [ + 'arrow {} from {},{} to {},{} lw 4 lc {} nohead front'.format( + i+5, dp[0]-nfiles*dx/2., dp[1], dp[0]+nfiles*dx/2., dp[1], default_colors[-10] + ) for i,dp in enumerate(exp_data) + ], name = os.path.join(outDir, guest), yreverse = True, + key = [ 'at graph 1.02, 1.17', 'maxrows 2', 'width -1.1', 'nobox' ], + ylabel = 'electronic binding energy (kJ/mol)', + xlabel = 'metals', rmargin = 0.99, tmargin = 0.88, size='7in,5.5in', + debug = True, layout = '1x2' ) return 'done' From dc8e2a4b8fe428a551ec3f1434cd7c7ab7974031 Mon Sep 17 00:00:00 2001 From: Johanna Huck Date: Sat, 11 Jul 2015 16:01:49 -0700 Subject: [PATCH 14/20] plots panel-figure for decomposed interaction energies --- ccsgp_get_started/dftplots/gp_interaction.py | 90 ++++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100644 ccsgp_get_started/dftplots/gp_interaction.py diff --git a/ccsgp_get_started/dftplots/gp_interaction.py b/ccsgp_get_started/dftplots/gp_interaction.py new file mode 100644 index 0000000..e9232e5 --- /dev/null +++ b/ccsgp_get_started/dftplots/gp_interaction.py @@ -0,0 +1,90 @@ +import logging, argparse, os, sys +import numpy as np +from collections import OrderedDict +from ..ccsgp.ccsgp import make_panel +from ..examples.utils import getWorkDirs +from ..ccsgp.utils import getOpts, colorscale +from ..ccsgp.config import default_colors +from string import ascii_lowercase + +def gp_interaction(): + """example for plotting from a text file via numpy.loadtxt + + 1. prepare input/output directories + 2. load the data into an OrderedDict() [adjust axes units] + 3. call ccsgp.make_panel with data from 2 + + Below is an output image for country initial T and the 4 most populated + countries for this initial (click to enlarge). Also see:: + + $ python -m ccsgp_get_started.examples.gp_datdir -h + + for help on the command line options. + + .. image:: pics/T.png + :width: 450 px + + .. image:: pics/U.png + :width: 450 px + + :param initial: country initial + :type initial: str + :param topN: number of most populated countries to plot + :type topN: int + :ivar inDir: input directory according to package structure and initial + :ivar outDir: output directory according to package structure + :ivar data: OrderedDict with datasets to plot as separate keys + :ivar file: data input file for specific country, format: [x y] OR [x y dx dy] + :ivar country: country, filename stem of input file + :ivar file_url: absolute url to input file + :ivar nSets: number of datasets + """ + # prepare color arrays for dataset + my_color_set = [default_colors[i] for i in [0,2]] + my_color_array = [] + for icol, color in enumerate(my_color_set): + my_color_array.append(colorscale(color[-7:-1], 0.8)) + my_color_array.append(colorscale(color[-7:-1], 1.4)) + # prepare input/output directories + inDir, outDir = getWorkDirs() + dpt_dict = OrderedDict() + for fold_idx,fold in enumerate(['totalE', 'Ex', 'Ec_LDA', 'Ec_vdW']): + energy = os.path.splitext(fold)[0] + key = '('+list(ascii_lowercase)[fold_idx]+')' + # prepare data + dpt_dict[key] = [[], [], []] #dpt + for index,funct in enumerate(os.listdir(os.path.join(inDir, energy))): + funct_name = os.path.splitext(funct)[0] + file_url = os.path.join(inDir, energy, funct) + data_import = np.loadtxt(open(file_url, 'rb')) #load data + data_import[:,0] *= 10. + dpt_dict[key][0].append(data_import) + dpt_dict[key][1].append('with linespoints lw 4 pt 18 ps 1.5 lt 2 lc %s' % + my_color_array[index]) + dpt_dict[key][2].append(funct_name) + #print dpt_dict + logging.debug(dpt_dict) # shown if --log flag given on command line + # generate plot using ccsgp.make_plot + make_panel( + dpt_dict = dpt_dict, + name = os.path.join(outDir, 'interaction'), + xr = [18, 45.3], yr = [-55, 20], + key = ['bottom right', 'maxrows 2', 'width -1.1', 'nobox' ], + ylabel = 'DFT binding energy (kJ/mol)', + xlabel = 'Mg-O distance, r (nm)', rmargin = 0.98, size='7in,7.5in', + lines = {'x=0': 'lc {} lw 4 lt 1'.format(default_colors[-10])}, + debug = False, layout = '2x2', key_subplot_id = 2 + ) + return 'done' + +if __name__ == '__main__': + parser = argparse.ArgumentParser() + #parser.add_argument("initial", help="country initial = input subdir with txt files") + #parser.add_argument("topN", help="number of most populated countries to plot") + parser.add_argument("--log", help="show log output", action="store_true") + args = parser.parse_args() + loglevel = 'DEBUG' if args.log else 'WARNING' + logging.basicConfig( + format='%(message)s', level=getattr(logging, loglevel) + ) + print gp_interaction() From 34aa975ad6aec002d1cda9cc1de9e732a77a35a8 Mon Sep 17 00:00:00 2001 From: Johanna Huck Date: Tue, 11 Aug 2015 11:17:52 +0200 Subject: [PATCH 15/20] add .DS_Store to gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 2b31cd7..ee4bacc 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ env/* *.pyc *.swp +.DS_Store output/* ccsgp_get_started/.changes ccsgp_get_started.egg-info From 45558f8e4eefec85d4afbd6e7d3cfb9db385753a Mon Sep 17 00:00:00 2001 From: Johanna Huck Date: Tue, 11 Aug 2015 11:36:59 +0200 Subject: [PATCH 16/20] update make_panel for metal-guest distance plots --- ccsgp_get_started/dftplots/gp_bindenergy.py | 22 +++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/ccsgp_get_started/dftplots/gp_bindenergy.py b/ccsgp_get_started/dftplots/gp_bindenergy.py index 2545771..c83f603 100644 --- a/ccsgp_get_started/dftplots/gp_bindenergy.py +++ b/ccsgp_get_started/dftplots/gp_bindenergy.py @@ -79,21 +79,27 @@ def gp_bindenergy(guest): dpt_dict['relative difference'][2].append(dpt_dict['absolute'][2][idx+1]) logging.debug(dpt_dict) # shown if --log flag given on command line # generate plot using ccsgp.make_panel + exp_data_gpcalls = [ + 'arrow {} from {},{} to {},{} lw 4 lc {} nohead front'.format( + i+5, dp[0]-nfiles*dx/2., dp[1], dp[0]+nfiles*dx/2., dp[1], default_colors[-10] + ) for i,dp in enumerate(exp_data) + ] if use_exp_data else [] + guest_split = guest.split('_') + ylabel = '{} distance for {} binding (nm)'.format(guest_split[0], guest_split[1]) if isM \ + else 'electronic binding energy (kJ/mol)' make_panel( dpt_dict = dpt_dict, gpcalls = [ 'boxwidth {} absolute'.format(dx), 'style fill solid 1.0 border lt -1', 'xtics ("Mg"1, "Mn"2, "Fe"3, "Co"4, "Ni"5, "Cu"6, "Zn"7)', - ] + [ - 'arrow {} from {},{} to {},{} lw 4 lc {} nohead front'.format( - i+5, dp[0]-nfiles*dx/2., dp[1], dp[0]+nfiles*dx/2., dp[1], default_colors[-10] - ) for i,dp in enumerate(exp_data) - ], name = os.path.join(outDir, guest), yreverse = True, + ] + exp_data_gpcalls, + name = os.path.join(outDir, guest), yreverse = (not isM), key = [ 'at graph 1.02, 1.17', 'maxrows 2', 'width -1.1', 'nobox' ], - ylabel = 'electronic binding energy (kJ/mol)', - xlabel = 'metals', rmargin = 0.99, tmargin = 0.88, size='7in,5.5in', - debug = True, layout = '1x2' + ylabel = ylabel, xlabel = 'metals', rmargin = 0.99, + tmargin = 0.93 if guest != 'M-O_H2O_relax' and use_exp_data else 0.88, + size='7in,5.5in' if guest != 'M-O_H2O_relax' and use_exp_data else '4in,5.5in', + debug = True, layout = '1x2' if guest != 'M-O_H2O_relax' and use_exp_data else '1x1' ) return 'done' From 38fd91de3694960a6a117ded1e336c81f6250f01 Mon Sep 17 00:00:00 2001 From: Johanna Huck Date: Tue, 11 Aug 2015 11:42:10 +0200 Subject: [PATCH 17/20] change titles with key entry --- ccsgp_get_started/dftplots/gp_bindenergy.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ccsgp_get_started/dftplots/gp_bindenergy.py b/ccsgp_get_started/dftplots/gp_bindenergy.py index c83f603..4760f68 100644 --- a/ccsgp_get_started/dftplots/gp_bindenergy.py +++ b/ccsgp_get_started/dftplots/gp_bindenergy.py @@ -29,7 +29,6 @@ def gp_bindenergy(guest): :ivar file_url: absolute url to input file :ivar nfiles: number of files :ivar dx: bar width estimated for specific amount of datasets - :ivar gap: space between 2 bars """ # prepare color arrays for dataset my_color_set = [default_colors[3]] + [default_colors[i] for i in range(0, 3)] @@ -45,7 +44,10 @@ def gp_bindenergy(guest): return "guest %s doesn't exist" % guest # prepare data dpt_dict = OrderedDict() - dpt_dict['absolute'] = [[], [], []] #dpt + if 'CO2' in guest: key = '(a)' + elif 'CH4' in guest: key = '(b)' + else: key = '(a)' + dpt_dict[key] = [[], [], []] #dpt # exp-data exp_data = np.loadtxt(open(os.path.join(inDir,'experiments.dat'), 'rb')) # load exp_data dpt_dict['absolute'][0].append(np.array([[1,-5]])) From 0074d728057d85c2f77565876616312703045814 Mon Sep 17 00:00:00 2001 From: Johanna Huck Date: Tue, 11 Aug 2015 11:46:39 +0200 Subject: [PATCH 18/20] prepare input data for metal-guest distance plots --- ccsgp_get_started/dftplots/gp_bindenergy.py | 57 ++++++++++++++------- 1 file changed, 39 insertions(+), 18 deletions(-) diff --git a/ccsgp_get_started/dftplots/gp_bindenergy.py b/ccsgp_get_started/dftplots/gp_bindenergy.py index 4760f68..15f5668 100644 --- a/ccsgp_get_started/dftplots/gp_bindenergy.py +++ b/ccsgp_get_started/dftplots/gp_bindenergy.py @@ -49,10 +49,22 @@ def gp_bindenergy(guest): else: key = '(a)' dpt_dict[key] = [[], [], []] #dpt # exp-data - exp_data = np.loadtxt(open(os.path.join(inDir,'experiments.dat'), 'rb')) # load exp_data - dpt_dict['absolute'][0].append(np.array([[1,-5]])) - dpt_dict['absolute'][1].append('with boxes lt -1 lc %s' % default_colors[-10]) - dpt_dict['absolute'][2].append('experiments') + exp_filename = os.path.join(inDir,'experiments.dat') + use_exp_data = os.path.exists(exp_filename) + isM = guest.startswith('M-') + if use_exp_data: + exp_data = np.loadtxt(open(exp_filename, 'rb')) # load exp_data + if len(exp_data.shape) < 2: + exp_data = np.array([exp_data]) + if isM: exp_data[:,1] *= 10. + yfake = -5 if use_exp_data else -40 + if isM: yfake = 1 + dpt_dict[key][0].append(np.array([[1,yfake]])) + dpt_dict[key][1].append( + 'with boxes lt -1 lc {}'.format(default_colors[-10]) if use_exp_data else \ + 'with lines lc rgb "white"' + ) + dpt_dict[key][2].append('experiments' if use_exp_data else ' ') # sim-data files = [ os.path.join(inDir, funct+ext) @@ -61,24 +73,33 @@ def gp_bindenergy(guest): ] nfiles = len(files) dx = 0.7/nfiles - gap = (1. - dx*nfiles)/2 for idx,file_url in enumerate(files): funct = os.path.splitext(os.path.basename(file_url))[0] data_import = np.loadtxt(open(file_url, 'rb')) # load data - data_import[:,0] += (idx - nfiles/2. + 0.5*(not nfiles%2)) * dx - dpt_dict['absolute'][0].append(data_import) - dpt_dict['absolute'][1].append('with boxes lt -1 lc %s' % my_color_array[idx]) - dpt_dict['absolute'][2].append(funct) + data_import[:,0] += (idx - (nfiles-1)/2.) * dx + if isM: data_import[:,1] *= 10. + dpt_dict[key][0].append(data_import) + dpt_dict[key][1].append('with boxes lt -1 lc %s' % my_color_array[idx]) + dpt_dict[key][2].append(funct) # relative differences - dpt_dict['relative difference'] = [[], [], []] #dpt - for idx,d in enumerate(dpt_dict['absolute'][0][1:]): - diff = np.copy(d) - exp_data_mod = exp_data if idx != 0 else exp_data[(0,6),:] - diff[:,1] /= -exp_data_mod[:,1] - diff[:,1] += 1. - dpt_dict['relative difference'][0].append(diff) - dpt_dict['relative difference'][1].append('with boxes lt -1 lc %s' % my_color_array[idx]) - dpt_dict['relative difference'][2].append(dpt_dict['absolute'][2][idx+1]) + if guest != 'M-O_H2O_relax' and use_exp_data: + dpt_dict[' '] = [[], [], []] #dpt + for idx,d in enumerate(dpt_dict[key][0][1:]): + if not isM and idx == 4: continue + try: + exp_data_mod = exp_data if idx != 0 else exp_data[(0,6),:] + except: + exp_data_mod = np.array([exp_data[0,:]]) + diff = np.copy(d) + if len(diff) != len(exp_data_mod): + for i,dp in enumerate(diff): + if i >= len(exp_data_mod) or round(dp[0]) != exp_data_mod[i,0]: + exp_data_mod = np.insert(exp_data_mod, i, [round(dp[0]), dp[1]], 0) + diff[:,1] /= exp_data_mod[:,1] + diff[:,1] -= 1. + dpt_dict[' '][0].append(diff) + dpt_dict[' '][1].append('with boxes lt -1 lc %s' % my_color_array[idx]) + dpt_dict[' '][2].append(dpt_dict[key][2][idx+1]) logging.debug(dpt_dict) # shown if --log flag given on command line # generate plot using ccsgp.make_panel exp_data_gpcalls = [ From e85b2f9ce627be6f23198300502f3c08b54063f6 Mon Sep 17 00:00:00 2001 From: Johanna Huck Date: Tue, 11 Aug 2015 13:42:29 +0200 Subject: [PATCH 19/20] fix units for nanometers --- ccsgp_get_started/dftplots/gp_bindenergy.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ccsgp_get_started/dftplots/gp_bindenergy.py b/ccsgp_get_started/dftplots/gp_bindenergy.py index 15f5668..f1f6179 100644 --- a/ccsgp_get_started/dftplots/gp_bindenergy.py +++ b/ccsgp_get_started/dftplots/gp_bindenergy.py @@ -56,7 +56,7 @@ def gp_bindenergy(guest): exp_data = np.loadtxt(open(exp_filename, 'rb')) # load exp_data if len(exp_data.shape) < 2: exp_data = np.array([exp_data]) - if isM: exp_data[:,1] *= 10. + if isM: exp_data[:,1] /= 10. yfake = -5 if use_exp_data else -40 if isM: yfake = 1 dpt_dict[key][0].append(np.array([[1,yfake]])) @@ -77,7 +77,7 @@ def gp_bindenergy(guest): funct = os.path.splitext(os.path.basename(file_url))[0] data_import = np.loadtxt(open(file_url, 'rb')) # load data data_import[:,0] += (idx - (nfiles-1)/2.) * dx - if isM: data_import[:,1] *= 10. + if isM: data_import[:,1] /= 10. dpt_dict[key][0].append(data_import) dpt_dict[key][1].append('with boxes lt -1 lc %s' % my_color_array[idx]) dpt_dict[key][2].append(funct) From 95cac1b22686c11958ca23afc4fe5fcb49ed66a2 Mon Sep 17 00:00:00 2001 From: Johanna Huck Date: Tue, 11 Aug 2015 13:49:15 +0200 Subject: [PATCH 20/20] same unit fix as in gp_bindenergy --- ccsgp_get_started/dftplots/gp_interaction.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ccsgp_get_started/dftplots/gp_interaction.py b/ccsgp_get_started/dftplots/gp_interaction.py index e9232e5..5755dfa 100644 --- a/ccsgp_get_started/dftplots/gp_interaction.py +++ b/ccsgp_get_started/dftplots/gp_interaction.py @@ -57,7 +57,7 @@ def gp_interaction(): funct_name = os.path.splitext(funct)[0] file_url = os.path.join(inDir, energy, funct) data_import = np.loadtxt(open(file_url, 'rb')) #load data - data_import[:,0] *= 10. + data_import[:,0] /= 10. dpt_dict[key][0].append(data_import) dpt_dict[key][1].append('with linespoints lw 4 pt 18 ps 1.5 lt 2 lc %s' % my_color_array[index]) @@ -68,7 +68,7 @@ def gp_interaction(): make_panel( dpt_dict = dpt_dict, name = os.path.join(outDir, 'interaction'), - xr = [18, 45.3], yr = [-55, 20], + xr = [1.8, 4.53], yr = [-55, 20], key = ['bottom right', 'maxrows 2', 'width -1.1', 'nobox' ], ylabel = 'DFT binding energy (kJ/mol)', xlabel = 'Mg-O distance, r (nm)', rmargin = 0.98, size='7in,7.5in',