Using Plot to Generate a Complex Figure

Using plot to generate a complex, publication-ready figure

****** The System ******************************************************
spectrometer(MHz)  *
spinning_freq(kHz) *
channels           H1
nuclei             H1
atomic_coords      *
cs_isotropic       *
csa_parameters     *
j_coupling         *
quadrupole         *
dip_switchboard    *
csa_switchboard    *
exchange_nuclei    *
bond_len_nuclei    *
bond_ang_nuclei    *
tors_ang_nuclei    *
groups_nuclei      *
******* Pulse Sequence **************************************************
CHN 1
timing(usec)       0
power(kHz)         0
phase(deg)         0
freq_offs(kHz)     0
******* Variables *******************************************************

** This input file has been used to generate Figure 2 for the following paper:

** Kaiser et al., Broadband selective excitation radiofrequency pulses for optimized localization in vivo, Magnetic Resonance in Medicine (2022)
** https://doi.org/10.1002/mrm.29119

** There is no need to read the above paper to understand this input file
** Just see the resulting figure (figure.pdf) and follow the notes below

** The figure illustrates the properties of three selective excitation pulses
** Each row of subfigures corresponds to one of these pulses:
** P10, EB2000A, and EQ4000A
** The 1st column of subfigures shows the pulse shape
** The 2nd column shows the excitation profile
** The 3rd column shows a 2D slice simulation as a filled contour plot

** The data files for this figure were generated using
** examples/selective-pulses/sel-exc and examples/mrs-slaser/slaser2D

** Alternative way to generate this Figure: Instead of running "spinev figure",
** save the contents of the Variables section as a separate file,
** start spinev in the -calc mode, and run script("filename")

****************************************************************************

** Figure width and height, in
FW=6.90  // full page width
FH=5.65

** Aspect Ratio (W/H) for the subfigures
AR = 4/3

** The placement of the lower left subfigure will be specified as --axes X0,Y0,W,H
X0 = 0.060      // units: fraction of FW
Y0 = 0.060      // units: fraction of FH
H = 0.281       // units: fraction of FH
W = AR*H*FH/FW  // units: fraction of FW

** Horizontal and vertical spacing b/w subfigures, fractional units
dx = 0.054
dy = 0.046

** The placement of the filled contour plots (the 3rd column of subfigures)
X3 = X0+2*(W+dx)-0.02 // X0 of the 3rd column of subfigures, fractional units
W3 = H*FH/FW          // W of the 3rd column of subfigures (making them square)

** Axes labeling for the filled contour plots
T3 = "--text 0.30,0.03,'ref 180°\, mm',,w --text 0.92,0.30,'exc 90°\, mm',,w,90"

** Subfigure letter location, fractional coordinates
L = "0.07,0.87"

** Options for EQ4000A subfigures (G,H,I)

Q1 = f"EQ4000A_plot1.dat --xlabel 'time, ms' --ylabel '$B_1$ amplitude, $\mu T$' --ylim=-25,25 --xlim=0,5 --text 0.91,0.07,'EQ4000A',9.5,,90 --text [L],$\mathbf{G}$,11 --axes [X0],[Y0],[W],[H] "

Q2 = f"EQ4000A_re.dat --xlabel 'frequency offset, kHz' --ylim=-0.43,1.07 --ynticks 3 --xlim=-8,8 --xnticks 5 --text -1.8,0.35,'8.4 kHz',,,,d --exec ax.hlines(0.5,-4.2,4.2,colors='k',linewidths=0.7) --text [L],$\mathbf{H}$,11 --axes [X0+W+dx],[Y0],[W],[H] "

Q3 = f"EQ4000A_2D_re.dat --contf --axis-off --text [L],'$\mathbf{I}$',11,w [T3] --axes [X3],[Y0],[W3],[H] "

** Options for EB2000A subfigures (D,E,F)

B1 = f"EB2000A_plot1.dat --ylabel '$B_1$ amplitude, $\mu T$' --ylim=-25,25 --xlim=0,4 --text 0.91,0.07,'EB2000A',9.5,,90 --text [L],$\mathbf{D}$,11 --axes [X0],[Y0+H+dy],[W],[H] "

B2 = f"EB2000A_re.dat --ylim=-0.43,1.07 --ynticks 3 --xlim=-8,8 --xnticks 5 --text -1.8,0.35,'5.6 kHz',,,,d --exec ax.hlines(0.5,-2.8,2.8,colors='k',linewidths=0.7) --text [L],$\mathbf{E}$,11 --axes [X0+W+dx],[Y0+H+dy],[W],[H] "

B3 = f"EB2000A_2D_re.dat --contf --axis-off --text [L],'$\mathbf{F}$',11,w [T3] --axes [X3],[Y0+H+dy],[W3],[H] "

** Options for P10 subfigures (A,B,C)

P1 = f"P10_plot1.dat --ylabel '$B_1$ amplitude, $\mu T$' --legend real,imag --legloc 'upper center' --ylim=-25,25 --xlim=0,1.6 --text 0.91,0.14,'P10',9.5,,90 --text [L],$\mathbf{A}$,11 --axes [X0],[Y0+2*(H+dy)],[W],[H] "

P2 = f"P10_re.dat --legend '$M_x$, $M_y$' --ylim=-0.43,1.07 --ynticks 3 --xlim=-8,8 --xnticks 5 --text -1.10,0.33,'4 kHz',,,,d --exec ax.hlines(0.5,-2,2,colors='k',linewidths=0.7) --text [L],$\mathbf{B}$,11 --axes [X0+W+dx],[Y0+2*(H+dy)],[W],[H] "

P3 = f"P10_2D_re.dat --contf --axis-off --text [L],$\mathbf{C}$,11,w [T3] --axes [X3],[Y0+2*(H+dy)],[W3],[H] "

** Plot the Figure
** Options common to all subfigures are given first, followed by the options for each subfigure

plot(f"--lines=-,-- --colors=k --widths=0.9 --font Arial --fontsize 9 --ksize 8 --xpad 4 --ypad 2 --ykpad 2 --ticks-in --size [FW],[FH] --contn 11 --cmap gray --colorbar-off --save figure.pdf " & P1 & P2 & P3 & B1 & B2 & B3 & Q1 & Q2 & Q3)

******* Options etc *****************************************************
rho0               I1z
observables        I1z
EulerAngles        *
n_gamma            *
line_broaden(Hz)   *
zerofill           *
FFT_dimensions     *
options            -v0 -o0
**************************************************************************