0

If i have a pgfplots figure in some place in my file, how can i reference it afterwards?

\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}

If this is the figure, how can i say, e.g.: Like seen in figure 6 eigen compares nicely to fastor. ? And is it possible to collect all my figures in one file and then just reference them later on in my text? How would latex figure out where to put the figures?

1

1 Answer 1

0

If the tikzpicture is inside a figure with a caption, it can be referenced:

\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}
1
  • Thank you. This is exactly what i was looking for. I would like to upvote your post, but i don't have enough reputation Commented May 1, 2019 at 16:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .