From 52988241a6ee5f8f0ad3636272075c348776cd1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Haberth=C3=BCr?= Date: Tue, 20 Sep 2016 11:46:51 +0200 Subject: [PATCH 1/2] Other colormap, rescale of figure --- example.py | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/example.py b/example.py index 8dfe166..7fd7a01 100644 --- a/example.py +++ b/example.py @@ -1,5 +1,9 @@ import BrukerMRI as bruker -import pylab as pl +import matplotlib.pyplot as plt + +# Display defaults +plt.rc('image', cmap='viridis', interpolation='nearest') # Display all images equally +plt.rcParams['figure.figsize'] = (16, 5) # Widescreen figures MainDir = "example_dataset/" ExpNum = 100 @@ -9,18 +13,18 @@ Experiment.ReconstructKspace() # show the resulting images -pl.figure() -pl.subplot(131) -pl.imshow(abs(Experiment.reco_data[:,:,0])) +plt.figure() +plt.subplot(131) +plt.imshow(abs(Experiment.reco_data[:,:,0])) -pl.subplot(132) -pl.imshow(abs(Experiment.reco_data[:,:,1])) +plt.subplot(132) +plt.imshow(abs(Experiment.reco_data[:,:,1])) -pl.subplot(133) -pl.imshow(abs(Experiment.reco_data[:,:,2])) +plt.subplot(133) +plt.imshow(abs(Experiment.reco_data[:,:,2])) -pl.suptitle("MRI method: " + Experiment.method["Method"] + \ - ", Matrix: " + str(Experiment.method["PVM_Matrix"][0]) + \ - " x " + str(Experiment.method["PVM_Matrix"][1])) +plt.suptitle("MRI method: " + Experiment.method["Method"] + \ + ", Matrix: " + str(Experiment.method["PVM_Matrix"][0]) + \ + " x " + str(Experiment.method["PVM_Matrix"][1])) -pl.show() +plt.show() From 86bcb8d2a5d401ef2005cbfe327ca4f8736efc64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Haberth=C3=BCr?= Date: Tue, 20 Sep 2016 15:14:32 +0200 Subject: [PATCH 2/2] Collect subplots in one loop --- example.py | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/example.py b/example.py index 7fd7a01..9bbe959 100644 --- a/example.py +++ b/example.py @@ -14,14 +14,9 @@ # show the resulting images plt.figure() -plt.subplot(131) -plt.imshow(abs(Experiment.reco_data[:,:,0])) - -plt.subplot(132) -plt.imshow(abs(Experiment.reco_data[:,:,1])) - -plt.subplot(133) -plt.imshow(abs(Experiment.reco_data[:,:,2])) +for i in range(3): + plt.subplot(1,3,i+1) + plt.imshow(abs(Experiment.reco_data[:,:,i])) plt.suptitle("MRI method: " + Experiment.method["Method"] + \ ", Matrix: " + str(Experiment.method["PVM_Matrix"][0]) + \