1

Here is my data using for construct plots(in a file named "00-data.txt") with the package "pgfplots".

id a b  time
1  1 1  235958
2  2 4  235959
3  3 9  000000
4  4 16 000001
5  5 25 000002

I construct my plots with the column "id" as the data of x-axis, butI want to use the column "time" as the nodes shown on x-axis, that is to say, "235958, 235959 ..." shown on x-axis, not "1, 2, 3, 4, 5". Anyone can help me with this?

My MWE:

\documentclass{article}
\usepackage{pgfplots}
\begin{document}

\begin{tikzpicture}
\begin{axis}[
title=example,
xlabel={$time$},
ylabel={$data$},
]
\addplot [blue] table {00-data.txt};
\addplot [red] table[x=id,y=b] {00-data.txt};
\end{axis}
\end{tikzpicture}

\end{document}
lyl
  • 2,727
  • 1
    You're after xticklabels from table, see e.g. https://tex.stackexchange.com/questions/21220/using-labels-from-a-file-in-pgfplot/21224#21224 – Torbjørn T. Dec 01 '18 at 11:06
  • @Torbjφm T. Many thanks for your proposal. That's what I want! – lyl Dec 01 '18 at 13:17

0 Answers0