每次运行特定的科学模型时,我都希望生成摘要PDF,我将要检查模型每个阶段的图形。
因此,每个模型运行都会生成一个2页的PDF,每个页面都有11或12个子图和一些摘要文本。
我的代码可以做一个最小的工作示例,但是当生成PDF时,我可以选择单个轴标签的文本或标题中的单个字符吗?
我现在拥有的:(突出显示蓝色背景)
我怎样才能生成子图,以便我可以选择整个子图作为我可以复制的图像。 (蓝色背景也突出显示)
我是否应该有效地保存许多SVG,每个子图一个,并将它们作为PNG嵌入到PDF中?
with PdfPages(path.join(outputPath, fileName)) as pdf:
for i in range(len(periphery)):
figure = plt.figure(1, (8.5, 11), dpi=300)
gs = gridspec.GridSpec(6, 4)
periph = periphery[i]
stimulus = periph[p.Stimulus]
pointCount = len(stimulus)
time = np.linspace(0, pointCount / conf.Fs, num=pointCount)
# plot stimulus
stimt = plt.subplot(gs[0, :-3])
stimt.plot(time, stimulus, lw=2)
stimt.set_xlabel("Time, s")
stimt.set_ylabel("Amplitude ")
stimt.set_title("Stimulus")
stimf = plt.subplot(gs[1, 3:-1])
pdf.savefig(figure)