# Prepare Python environment
import scipy.io as sio
import numpy as np
from pathlib import Path
data_dir = Path("../../../data/06-MT-03-MTsat")
data_file = "fig1_mtsat.mat"
#Load either archived or generated plot variables
mat_contents = sio.loadmat(data_dir / data_file)
MTsats = mat_contents["MTsats"][0]
MTRs = mat_contents["MTRs"][0]
T1s = mat_contents["T1s"][0]
T1f = mat_contents["T1_range"][0]
# Plot Figure 1
# Module imports
import matplotlib.pyplot as plt
import plotly as py
import plotly.graph_objs as go
import numpy as np
from plotly import __version__
from plotly.subplots import make_subplots
from plotly.offline import download_plotlyjs, init_notebook_mode, plot, iplot
config={'showLink': False, 'displayModeBar': False}
init_notebook_mode(connected=True)
# PYTHON CODE
init_notebook_mode(connected=True)
# The polling here is to ensure that plotly.js has already been loaded before
# setting display alignment in order to avoid a race condition.
## Setup for plots
fig = make_subplots(rows=1, cols=3, horizontal_spacing = 0.1)
fig.add_trace(
go.Scatter(
x=T1f,
y=MTRs,
hoverinfo = 'y',
showlegend=False
), row= 1, col=1
)
fig.add_trace(
go.Scatter(
x=T1f,
y=T1s,
hoverinfo = 'y',
showlegend=False
), row= 1, col=2
)
fig.add_trace(
go.Scatter(
x=T1f,
y=MTsats,
hoverinfo = 'y',
showlegend=False
), row= 1, col=3
)
layout = go.Layout(
width=720,
height=300,
margin=go.layout.Margin(
l=60,
r=30,
b=60,
t=60,
),
annotations=[
dict(
x=-0.15,
y=0.50,
showarrow=False,
text='MTsat (%)',
font=dict(
family='Times New Roman',
size=22
),
textangle=-90,
xref='paper',
yref='paper'
),
dict(
x=-0.15,
y=0.50,
showarrow=False,
text='MTsat (%)',
font=dict(
family='Times New Roman',
size=22
),
textangle=-90,
xref='paper',
yref='paper'
),
dict(
x=0.51,
y=-0.3,
showarrow=False,
text='T1f (s)',
font=dict(
family='Times New Roman',
size=22
),
textangle=0,
xref='paper',
yref='paper'
),
dict(
x=0.92,
y=-0.3,
showarrow=False,
text='T1f (s)',
font=dict(
family='Times New Roman',
size=22
),
textangle=0,
xref='paper',
yref='paper'
),
dict(
x=0.1,
y=-0.3,
showarrow=False,
text='T1f (s)',
font=dict(
family='Times New Roman',
size=22
),
textangle=0,
xref='paper',
yref='paper'
),
dict(
x=-0.08,
y=0.5,
showarrow=False,
text='MTR',
font=dict(
family='Times New Roman',
size=22
),
textangle=-90,
xref='paper',
yref='paper'
),
dict(
x=0.285,
y=0.5,
showarrow=False,
text='T<sub>1</sub> (s)',
font=dict(
family='Times New Roman',
size=22
),
textangle=-90,
xref='paper',
yref='paper'
),
dict(
x=0.685,
y=0.5,
showarrow=False,
text='MTsat (%)',
font=dict(
family='Times New Roman',
size=22
),
textangle=-90,
xref='paper',
yref='paper'
),
],
xaxis=dict(
showgrid=True,
gridcolor='rgb(169,169,169)',
linecolor='black',
linewidth=2
),
yaxis=dict(
showgrid=True,
gridcolor='rgb(169,169,169)',
linecolor='black',
linewidth=2,
range=[50,70]
),
xaxis2=dict(
showgrid=True,
gridcolor='rgb(169,169,169)',
linecolor='black',
linewidth=2,
range=[0.7,1.3]
),
yaxis2=dict(
showgrid=True,
gridcolor='rgb(169,169,169)',
linecolor='black',
linewidth=2,
range=[0.7,1.3]
),
xaxis3=dict(
showgrid=True,
gridcolor='rgb(169,169,169)',
linecolor='black',
linewidth=2
),
yaxis3=dict(
showgrid=True,
gridcolor='rgb(169,169,169)',
linecolor='black',
linewidth=2,
range=[5,7]
),
)
fig.update_layout(layout)
iplot(fig, filename = 'fig4.html', config = config)
Loading...