我想用我自己的数据在乳胶 LaTeX 中绘制一条曲线。请问我该怎么做?这是包含数据的表格....
编辑
这是 2 个新文件
%test.dat
Num Min Moy Max
R1 100 100 100
R2 100 100 100
R3 250 250 250
R4 250 250 250
R5 500 500 500
R6 500 500 500
R7 750 750 750
R8 750 750 750
R9 1000 1000 1000
R10 1000 1000 1000
这是他的代码
\begin{figure}[!h]
\centering
\begin{tikzpicture}[scale=1]
\begin{axis}[%
% Lengend position
legend pos = outer north east,
% We need a tick for every data
xtick = data,
% The ticks label are provided in the file as the column named Num
xticklabels from table = {test2.dat}{Num}]
% How the data are separated.
% \pgfplotstableset{col sep = tab}
% We need to simulate an x coord since it is litteral in the data file. I choose to index on the line.
\addplot table [x expr = \lineno, y = Min] {test.dat};
\addlegendentry{Min}
\addplot table [x expr = \lineno, y = Moy] {test.dat};
\addlegendentry{Moy}
\addplot table [x expr = \lineno, y = Max] {test.dat};
\addlegendentry{Max}
\end{axis}
\end{tikzpicture}
\caption{Pub Partagée avec des pages dont la politique est Tout le Monde et ayant un Nb Min, Moy Max d'amis}
\end{figure}
答案1
为了简单起见,我将数据作为文件提供,值由制表符分隔,并且我为样本添加了标题。
% This is test.dat
Num Min Moy Max
R1 25.66 33 39.66
R2 40.2 48.16 56.66
R3 67.5 82 98.33
R4 104.83 125 141.5
R5 141 164 189.5
R6 211 236 259.66
R7 219 247 279.14
R8 316.75 355 392
R9 283.66 326 362.75
R10 427.5 471 513.42
% End of test.dat
源代码。
\documentclass{standalone}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[%
% Lengend position
legend pos = outer north east,
% We need a tick for every data
xtick = data,
% The ticks label are provided in the file as the column named Num
xticklabels from table = {test.dat}{Num},
title = {\Large\bfseries This is my curves}]
% We need to simulate an x coord since it is litteral in the data file. I choose to index on the line.
\addplot table [x expr = \lineno, y = Min] {test.dat};
\addlegendentry{Min}
\addplot table [x expr = \lineno, y = Moy] {test.dat};
\addlegendentry{Moy}
\addplot table [x expr = \lineno, y = Max] {test.dat};
\addlegendentry{Max}
\end{axis}
\end{tikzpicture}
\end{document}