为 Latex 格式化带有子图的 Matplotlib 图形

为 Latex 格式化带有子图的 Matplotlib 图形

我无法让我的情节涵盖整个\textwidth。这是我编译时得到的等效 MWE。在此处输入图片描述

Matplotlib 代码:(set_size是从中获取的函数这里,但实际上这也不起作用)

import matplotlib.pyplot as plt
import seaborn as sns

fmri = sns.load_dataset("fmri")
fig, ax = plt.subplots(1, 4, figsize=(28,5))
# fig, ax = plt.subplots(1, 4, figsize=set_size(465, subplots=(1,4)))

for i in range (4):
    sns.lineplot(x="timepoint", y="signal", err_style="bars", ci=68, ax=ax[i], data=fmri)
plt.suptitle("Timepoint vs Signal")
plt.savefig("timepoint_vs_signal.png")

乳胶代码:

\documentclass{article}
\usepackage[margin=1in]{geometry}
\usepackage{subfig,graphicx}
\usepackage[lined, boxed, ruled, commentsnumbered]{algorithm2e}
\usepackage{mathtools,array,savesym}
\usepackage{amsfonts,amsthm, amsmath}
\usepackage{lipsum}  
% these are the packages I need, so I'm including them just in case it's necessary info

\begin{document}
 
\lipsum[1]

% \showthe\textwidth % = ~469pt

\begin{figure}[ht]
\begin{center}
\includegraphics[width=\textwidth]{timepoint_vs_signal.png}
\end{center}
\end{figure}

\end{document}

我错过了什么?

相关内容