引用 pgfplots 图

引用 pgfplots 图

如果我的文件中某个地方有一个 pgfplots 图形,我该如何引用它?

\begin{tikzpicture}
    \begin{loglogaxis}[legend pos=outer north east, xlabel={\#FLOPS}, ylabel={time in $s$}]
        \addplot coordinates {(10, 41069)(100, 36272)(1000, 37183)(10000, 49653)(100000, 173360)(1000000, 524701)(10000000, 10161288)(100000000, 87902501)(1000000000, 167910718)(10000000000, 20320627286)(100000000000, 217273232886)(1000000000000, 538049137671)};
        \addlegendentry{ Fastor2D};
        \addplot coordinates {(10, 39855)(100, 39227)(1000, 44272)(10000, 84625)(100000, 513951)(1000000, 3837277)(10000000, 65969067)(100000000, 425001508)(1000000000, 4048751612)(10000000000, 138821215507)(100000000000, 1389186505532)(1000000000000, 21198591175187)};
        \addlegendentry{ Blitz2D};
        \addplot coordinates {(10, 53834)(100, 113760)(1000, 59743)(10000, 182387)(100000, 226761)(1000000, 837170)(10000000, 1494975)(100000000, 8200807)(1000000000, 39245264)(10000000000, 277082078)(100000000000, 2545527258)(1000000000000, 24608770325)};
        \addlegendentry{ XTensor2D};
        \addplot coordinates {(10, 36895)(100, 44634)(1000, 39723)(10000, 48519)(100000, 52027)(1000000, 256271)(10000000, 1463178)(100000000, 11635263)(1000000000, 109152391)(10000000000, 708908499)(100000000000, 7235686838)(1000000000000, 69532828884)};
        \addlegendentry{ Eigen2D};
    \end{loglogaxis}
\end{tikzpicture}

如果是这个图,我该怎么说呢,例如:如图 6 所示,eigen 与 fastor 相比效果很好。?是否可以将所有图收集到一个文件中,然后在文本中引用它们?LaTeX 如何确定将图放在哪里?

答案1

如果tikzpicture位于带有标题的图形内,则可以引用:

\documentclass{article}

\usepackage{pgfplots}

\begin{document}

\begin{figure}[htbp]
\begin{tikzpicture}
    \begin{loglogaxis}[legend pos=outer north east, xlabel={\#FLOPS}, ylabel={time in $s$}]
        \addplot coordinates {(10, 41069)(100, 36272)(1000, 37183)(10000, 49653)(100000, 173360)(1000000, 524701)(10000000, 10161288)(100000000, 87902501)(1000000000, 167910718)(10000000000, 20320627286)(100000000000, 217273232886)(1000000000000, 538049137671)};
        \addlegendentry{ Fastor2D};
        \addplot coordinates {(10, 39855)(100, 39227)(1000, 44272)(10000, 84625)(100000, 513951)(1000000, 3837277)(10000000, 65969067)(100000000, 425001508)(1000000000, 4048751612)(10000000000, 138821215507)(100000000000, 1389186505532)(1000000000000, 21198591175187)};
        \addlegendentry{ Blitz2D};
        \addplot coordinates {(10, 53834)(100, 113760)(1000, 59743)(10000, 182387)(100000, 226761)(1000000, 837170)(10000000, 1494975)(100000000, 8200807)(1000000000, 39245264)(10000000000, 277082078)(100000000000, 2545527258)(1000000000000, 24608770325)};
        \addlegendentry{ XTensor2D};
        \addplot coordinates {(10, 36895)(100, 44634)(1000, 39723)(10000, 48519)(100000, 52027)(1000000, 256271)(10000000, 1463178)(100000000, 11635263)(1000000000, 109152391)(10000000000, 708908499)(100000000000, 7235686838)(1000000000000, 69532828884)};
        \addlegendentry{ Eigen2D};
    \end{loglogaxis}
\end{tikzpicture}
\caption{text}
\label{eigen_vs_fastor}
\end{figure}

Like seen in figure \ref{eigen_vs_fastor} eigen compares nicely to fastor. 

\end{document}

相关内容