# Prepare Python environment
import scipy.io as sio
from pathlib import Path
data_dir = Path("../../../data/06-MT-02-MTR")
data_file = "fig_1.mat"
#Load either archived or generated plot variables
mat_contents = sio.loadmat(data_dir / data_file)
## Plot
# Module imports
# PYTHON CODE
# Module imports
import matplotlib.pyplot as plt
import plotly.graph_objs as go
import numpy as np
from plotly import __version__
from plotly.offline import download_plotlyjs, init_notebook_mode, plot, iplot
config={'showLink': False, 'displayModeBar': False}
init_notebook_mode(connected=True)
# Prepare Python environment
tissue_names = mat_contents['tissue_names'].tolist()
tissues = [
tissue_names[0][0][0],
tissue_names[0][1][0],
tissue_names[0][2][0],
tissue_names[0][3][0],
tissue_names[0][4][0]
]
protocol_names = mat_contents['protocol_names'].tolist()
protocols = [
protocol_names[0][0][0],
protocol_names[0][1][0],
protocol_names[0][2][0],
protocol_names[0][3][0],
]
signal_brownSiemens = mat_contents["MTRs"][0]
signal_brownPhilips = mat_contents["MTRs"][1]
signal_karakuzuSiemens = mat_contents["MTRs"][2]
signal_karakuzuGE = mat_contents["MTRs"][3]
# Plot Figure 1
# Module imports
import matplotlib.pyplot as plt
import plotly.graph_objs as go
import numpy as np
from plotly import __version__
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.
brown_siemens = go.Scatter(
x = tissues,
y = signal_brownSiemens,
name = protocols[0],
text = 'N/A',
hoverinfo = 'y'
)
brown_philips = go.Scatter(
x = tissues,
y = signal_brownPhilips,
name = protocols[1],
hoverinfo = 'y'
)
karakuzu_siemens = go.Scatter(
x = tissues,
y = signal_karakuzuSiemens,
name = protocols[2],
hoverinfo = 'y'
)
karakuzu_ge = go.Scatter(
x = tissues,
y = signal_karakuzuGE,
name = protocols[3],
hoverinfo = 'y'
)
data = [brown_siemens, brown_philips, karakuzu_siemens, karakuzu_ge]
layout = go.Layout(
width=750,
height=750,
margin=go.layout.Margin(
l=100,
r=80,
b=100,
t=130,
),
annotations=[
dict(
x=-0.15,
y=0.50,
showarrow=False,
text='MTR',
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
),
legend=dict(
x=0.25,
y=1.3,
traceorder='normal',
font=dict(
family='Times New Roman',
size=12,
color='#000'
),
bordercolor='#000000',
borderwidth=2
)
)
fig = dict(data=data, layout=layout)
iplot(fig, filename = 'fig1.html', config = config)
Loading...