我想要一些关于如何安排matplotlib.figure.Figure对象的建议
我使用以下函数(matplotlib.figure.Figure)创建一个类型为“https://nilearn.github.io/modules/generated/nilearn.plotting.plot_surf_roi.html”的对象:
from nilearn import plotting
def plot_surf(surface_data, view, fig):
img = plotting.plot_surf_roi(surface_data['surf_mesh'],
roi_map=surface_data['comp_labels'],
hemi=hemi, view=view,
cmap='RdBu_r',
vmax=np.nanmax(surface_data['comp_labels']),
vmin=np.nanmin(surface_data['comp_labels']),
bg_map=surface_data['bg_maps'],
darkness=0.6,
bg_on_data=True,
title='',
figure = fig)
return img我想做其中的几个,并将其安排为子情节。到目前为止,这是我失败的尝试:
fig = plt.figure()
fig, ax = plt.subplots()
plot_surf(surface_data, 'lateral', fig)
plot_surf(surface_data, 'medial', fig)
plt.show()任何建议都很感激
发布于 2020-05-17 14:37:02
试着这样做:
def plot_surf(surface_data, view, fig, axes):
img = plotting.plot_surf_roi(surface_data['surf_mesh'],
roi_map=surface_data['comp_labels'],
hemi=hemi, view=view,
cmap='RdBu_r',
vmax=np.nanmax(surface_data['comp_labels']),
vmin=np.nanmin(surface_data['comp_labels']),
bg_map=surface_data['bg_maps'],
darkness=0.6,
bg_on_data=True,
title='',
figure = fig,
axes=axes)
return img
fig, (ax1, ax2) = plt.subplots(2, subplot_kw={'projection': '3d'})
plot_surf(surface_data, 'lateral', fig, ax1)
plot_surf(surface_data, 'medial', fig, ax2)https://stackoverflow.com/questions/61851691
复制相似问题