Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I would like to draw a curve in latex LaTeX with my own datahow . How please I can do that.? this This is my table that contains the data....

EDIT

this is 2 new files

%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

and this is his code

\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}
share|improve this question
    
please if someone have an idea he tell me –  boutheina May 8 '12 at 9:40
    
@Jake: ok I will do that in the future but really I don't know how to do that in the previous time but since you tell me I will do that by myself –  boutheina May 8 '12 at 12:42
    
@Jake: please do you have an idea to resolve my problem? –  boutheina May 8 '12 at 12:43
    
It works fine for me. Are you sure you're plotting the right file (maybe you're mixing up data.dat and data2.dat)? –  Jake May 8 '12 at 12:55
    
@Jake: when you say that works fine for you the curve that you obtain reach 1000 in the axe of y or he just reach 500? because for me it reach only 500 –  boutheina May 8 '12 at 12:58

1 Answer 1

up vote 12 down vote accepted

For simplicity, I provide the data as a file, values are separated by tabs and I added a title to the samples.

% 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

The source code.

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

enter image description here

share|improve this answer
    
@boutheina See if the copy/paste preserved the tab separator in the file test.dat. –  cjorssen May 8 '12 at 10:34
    
@cjorssen: I see my file test.dat and it is write in the right form I use the tab but these errors appear again:! Package pgfplots Error: Sorry, could not retrieve column 'Min' from table '\\pgfplotstableread@filename@@table@name '. Please check spelling (or introduce name aliases)..See the pgfplots package documentation for explanation.Type H <return> for immediate help.... ...le [x expr = \lineno, y = Min] {test.dat}; –  boutheina May 8 '12 at 10:45
    
@Jake: when you use the code suggested by cjorssen it work? –  boutheina May 8 '12 at 10:52
    
@Jake: Thank you very much when I remove the line \pgfplotstableset{col sep = tab} the code is compilated thank you thank you –  boutheina May 8 '12 at 10:59
1  
@Jake Thanks. Answer edited according to your suggestion. –  cjorssen May 8 '12 at 11:07

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.