
我一直在使用 Sharelatex 來寫我的論文,並且累積了很多 pgfplots。在編譯逾時之前,我不能包含超過 6 個由 csv 檔案產生的 pgfplot。我一直將我的圖分成幾個 tex 檔。有沒有辦法以簡單的方式將所有這些最終組合在一起?我嘗試搜索,似乎一種選擇是將 pdf 文件轉換為 png 並將繪圖添加為圖像,但我失去了圖形的品質和清晰度(我嘗試了 imagemagick 並且對輸出不滿意)。我的選擇是什麼,請指教。謝謝。
這是許多組圖中的一個(作為範例):
\documentclass{standalone}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage{floatrow}
\usepackage{tikz}
\usepackage{pgfplots}
\usepackage{fixltx2e}
\usepackage{siunitx}
\usepackage{lscape}
\usepackage{diagbox}
\usepackage{caption}
\usepackage{xcolor}
\usepackage[version=4]{mhchem}
\usepackage{subcaption}
\usepgfplotslibrary{groupplots}
\DeclareSIUnit{\molar}{M}
\pgfplotsset{compat=newest}
\begin{document}
\begin{figure}[h]
\setlength{\abovecaptionskip}{15pt plus 3pt minus 2pt}
\begin{minipage}{\columnwidth}
\centering
\begin{tikzpicture}[scale = .65, transform shape,trim left]
\begin{groupplot}[
group style={
group size=2 by 3,
horizontal sep=0pt,
vertical sep=50pt
},
scale only axis,
xlabel={nm},
ylabel={Abs},
xmin=385, xmax=565,
xtick pos=left,
ytick pos=left,
no marks,
max space between ticks=1000pt,
try min ticks=4,
xlabel={},
ylabel={}
]
\nextgroupplot[title=\textbf{(a)} $15:60$ (TPPS\textsubscript{4}-\ce{2Cl}:\Lig{1})]
\addplot table [col sep=comma, x=nm, y=10] {ST053 1560 Por SG.csv};\label{1560porsg1}
\addplot table [col sep=comma, x=nm, y=100] {ST053 1560 Por SG.csv};\label{1560porsg2}
\addplot table [col sep=comma, x=nm, y=200] {ST053 1560 Por SG.csv};\label{1560porsg3}
\nextgroupplot[title=\textbf{(e)} $60:15$ (TPPS\textsubscript{4}-\ce{2Cl}:\Lig{1})]
\addplot table [col sep=comma, x=nm, y=10] {ST053 6015 Por SG.csv};
\addplot table [col sep=comma, x=nm, y=100] {ST053 6015 Por SG.csv};
\addplot table [col sep=comma, x=nm, y=200] {ST053 6015 Por SG.csv};
\nextgroupplot[title=\textbf{(g)} $60:15$ (TPPS\textsubscript{4}-\ce{2Cl}:Buffer)]
\addplot table [col sep=comma, x=nm, y=10] {ST053 6015 Por blank SG.csv};
\addplot table [col sep=comma, x=nm, y=100] {ST053 6015 Por blank SG.csv};
\addplot table [col sep=comma, x=nm, y=200] {ST053 6015 Por blank SG.csv};
\end{groupplot}
\node at ($(group c1r2.west)!0.5!(group c1r2.west)$)[xshift=-1.5cm]{\rotatebox{90}{\large{Absorption}}};
\node at ($(group c1r3.south)!0.5!(group c2r3.south)$)[yshift=-1.5cm]{\large{Nanometer}};
\end{tikzpicture}
\end{minipage}
\caption{Caption}
\end{figure}
\end{document}
答案1
我無法測試這個因為我無法編譯你的範例,因為它本質上取決於我沒有的文件。但是,您希望繪圖檔案看起來像這樣:
\documentclass[tikz]{standalone}
\usepackage[utf8]{inputenc}
\usepackage{pgfplots}
\usepackage{siunitx}
\usepackage{diagbox}
\usepackage[version=4]{mhchem}
\usepgfplotslibrary{groupplots}
\DeclareSIUnit{\molar}{M}
\pgfplotsset{compat=newest}
\begin{document}
\begin{tikzpicture}[scale = .65, transform shape, trim left]
\begin{groupplot}[
group style={
group size=2 by 3,
horizontal sep=0pt,
vertical sep=50pt
},
scale only axis,
xlabel={nm},
ylabel={Abs},
xmin=385, xmax=565,
xtick pos=left,
ytick pos=left,
no marks,
max space between ticks=1000pt,
try min ticks=4,
xlabel={},
ylabel={}
]
\nextgroupplot[title=\textbf{(a)} $15:60$ (TPPS\textsubscript{4}-\ce{2Cl}:\Lig{1})]
\addplot table [col sep=comma, x=nm, y=10] {ST053 1560 Por SG.csv};\label{1560porsg1}
\addplot table [col sep=comma, x=nm, y=100] {ST053 1560 Por SG.csv};\label{1560porsg2}
\addplot table [col sep=comma, x=nm, y=200] {ST053 1560 Por SG.csv};\label{1560porsg3}
\nextgroupplot[title=\textbf{(e)} $60:15$ (TPPS\textsubscript{4}-\ce{2Cl}:\Lig{1})]
\addplot table [col sep=comma, x=nm, y=10] {ST053 6015 Por SG.csv};
\addplot table [col sep=comma, x=nm, y=100] {ST053 6015 Por SG.csv};
\addplot table [col sep=comma, x=nm, y=200] {ST053 6015 Por SG.csv};
\nextgroupplot[title=\textbf{(g)} $60:15$ (TPPS\textsubscript{4}-\ce{2Cl}:Buffer)]
\addplot table [col sep=comma, x=nm, y=10] {ST053 6015 Por blank SG.csv};
\addplot table [col sep=comma, x=nm, y=100] {ST053 6015 Por blank SG.csv};
\addplot table [col sep=comma, x=nm, y=200] {ST053 6015 Por blank SG.csv};
\end{groupplot}
\node at ($(group c1r2.west)!0.5!(group c1r2.west)$)[xshift=-1.5cm]{\rotatebox{90}{\large{Absorption}}};
\node at ($(group c1r3.south)!0.5!(group c2r3.south)$)[yshift=-1.5cm]{\large{Nanometer}};
\end{tikzpicture}
\end{document}
然後在您的主文檔中包含如下圖:
\begin{figure}
\centering
\includegraphics{myfabulousplot}
\caption{My Fabulous Plot}
\label{fig:fabplot}
\end{figure}
不要使用figure
單一繪圖.tex
檔案中的環境。tikzpicture
例如,您只需要個人環境。
您也可以自動執行此操作。但是,如果您想避免超時,那麼自動並不是一個好主意。