我使用 PGFPlots 建立圖表並將其匯出到我的主題投影片中。我總是需要修剪導出的 pdf 文件的兩側。附件是此類圖表的範例。我想知道是否有一種方法可以自動將繪圖填入pdf文件的整個頁面中?
這是產生圖表的程式碼
\documentclass[a4paper]{article}
\usepackage{amsmath}
\usepackage{xcolor}
\usepackage{pgfplots}
\usepackage{pgfplotstable}%fitting functions
\usepackage{tikz}
\usetikzlibrary{tikzmark,patterns,pgfplots.fillbetween}
\pagestyle{empty}
\pgfkeys{/pgf/number format/.cd,fixed}
\pgfplotsset{compat=1.15}
\pgfplotsset{label style={font=\LARGE},
tick label style={font=\LARGE}}
\pgfplotsset{error bars/.cd,
x dir=both, x explicit,
y dir=both, y explicit,
}
\begin{document}
\begin{figure}
\centering
\begin{tikzpicture}
\begin{axis}[
enable tick line clipping=false, % makes all ticks same width
axis line style=semithick,
width=14cm,
height=7cm,
x tick style={black,semithick},
x label style=
{at={(ticklabel cs:0.5)},anchor=near ticklabel},
xlabel={$L$ [mm]},
xmin=0,xmax=100,
xtick={0,20,...,100},
xtick pos=bottom,
xtick align=outside,
y tick style={black,semithick},
y label style=
{at={(ticklabel cs:0.5)},anchor=near ticklabel},
ylabel={$F$ [N]},
ymin=-0.05,ymax=0.2,
ytick={-0.05,0,...,0.25},
ytick pos=left,
ytick align=outside,
]
\addplot [only marks,mark=*,mark options={scale=0.5,red,fill=white}] file {LDPE_PETG_2.txt};
\addplot [only marks,mark=*,mark options={scale=0.5,blue,fill=white}] file {LDPE-DOTO_PETG_2.txt};
\end{axis}
\end{tikzpicture}
\end{figure}
\end{document}