From 407a13f3558f0bcf2810e5c6a986fbbf5d24b147 Mon Sep 17 00:00:00 2001 From: Enne Hekma Date: Wed, 26 Oct 2016 15:43:29 +0200 Subject: [PATCH 1/2] Add option to porkchopplot to plot squares instead of contiunous plot. --- python/plot_porkchop.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/python/plot_porkchop.py b/python/plot_porkchop.py index f23c3ff..4e6d995 100644 --- a/python/plot_porkchop.py +++ b/python/plot_porkchop.py @@ -127,7 +127,12 @@ cmap = plt.get_cmap(config['colormap']) fig=plt.figure() ax1 = fig.add_subplot(111) -data = ax1.contourf(y1,x1,z,cmap=cmap) +y2 = np.row_stack((y1,y1[-1]+(y1[-1]-y1[-2]))) +y3 = np.column_stack((y2,y2[:,-1])) +x2 = np.column_stack((x1,x1[:,-1]+(x1[:,-1]-x1[:,-2]))) +x3 = np.row_stack((x2,x2[-1])) +data = ax1.pcolormesh(y3,x3,z,cmap=cmap) +# data = ax1.contourf(y1,x1,z,cmap=cmap) cbar = plt.colorbar(data, cmap=cmap) formatter = matplotlib.ticker.ScalarFormatter(useOffset=False) ax1.xaxis.set_major_formatter(formatter) From 71d339c224495e242028b0a62f5d82af462d9093 Mon Sep 17 00:00:00 2001 From: Enne Hekma Date: Tue, 31 Jan 2017 14:07:22 +0100 Subject: [PATCH 2/2] Add option to not use interpolation in porkchop plot. --- config/plot_porkchop.json.empty | 3 +++ python/plot_porkchop.py | 17 +++++++++++------ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/config/plot_porkchop.json.empty b/config/plot_porkchop.json.empty index 3350787..ba1389d 100644 --- a/config/plot_porkchop.json.empty +++ b/config/plot_porkchop.json.empty @@ -22,6 +22,9 @@ // display more or less details. If 0 no cutoff is assumed. "transfer_deltaV_cutoff" : 0, + // Indicate if plotting should be done with interpolation (countourf) or not (pcolormesh). + "interpolation" : false, + // Plot title or not, title includes information on the plot but isn't desired for publication. // Give "True" if title is desired, "False" if not. "title" : "", diff --git a/python/plot_porkchop.py b/python/plot_porkchop.py index 4e6d995..563344c 100644 --- a/python/plot_porkchop.py +++ b/python/plot_porkchop.py @@ -127,12 +127,17 @@ cmap = plt.get_cmap(config['colormap']) fig=plt.figure() ax1 = fig.add_subplot(111) -y2 = np.row_stack((y1,y1[-1]+(y1[-1]-y1[-2]))) -y3 = np.column_stack((y2,y2[:,-1])) -x2 = np.column_stack((x1,x1[:,-1]+(x1[:,-1]-x1[:,-2]))) -x3 = np.row_stack((x2,x2[-1])) -data = ax1.pcolormesh(y3,x3,z,cmap=cmap) -# data = ax1.contourf(y1,x1,z,cmap=cmap) + +if config['interpolation']==True: + data = ax1.contourf(y1,x1,z,cmap=cmap) + +if config['interpolation']==False: + y2 = np.row_stack((y1,y1[-1]+(y1[-1]-y1[-2]))) + y3 = np.column_stack((y2,y2[:,-1])) + x2 = np.column_stack((x1,x1[:,-1]+(x1[:,-1]-x1[:,-2]))) + x3 = np.row_stack((x2,x2[-1])) + data = ax1.pcolormesh(y3,x3,z,cmap=cmap) + cbar = plt.colorbar(data, cmap=cmap) formatter = matplotlib.ticker.ScalarFormatter(useOffset=False) ax1.xaxis.set_major_formatter(formatter)