1

Being new to Latex, I'm finding it hard to draw graphs in latex.enter image description here

I wish to draw this graph. Can anyone please help me with the same? Here is the code I had been trying to use:

\begin{tikzpicture} 
\begin{axis} 
\addplot coordinates { (1950,3) (1969,2.80) (1969,2.80) }; 
\end{axis} 
\end{tikzpicture}

And this is the data: (1950,3) (1969,2.80) (1978,2.796) (1979,2.78) (1981,2.548) (1982,2.517) (1984,2.496) (1986,2.479) (1989,2.367) I want my graph to be almost the same as in the picture attached. Thank you!

10
  • 1
    Maybe you help us help you with providing what you have tried so far, and the data for the graph?
    – vaettchen
    Aug 12, 2015 at 15:01
  • 1
    One option is to draw the graph in the software of your choice, save the result in a PDF or JPG file, and import the graph into LaTeX using the \includegraphics macro of the graphicx package. Aug 12, 2015 at 15:01
  • If doing so, I strongly recommend using a vector format. However, among the pixel based formats, you'd rather use PNG, because JPEG will have compression artifacts in pictures with high contrast, clear edges and thin lines. Aug 12, 2015 at 17:37
  • @vaettchen : This is the code I'm trying to use.\begin{tikzpicture} \begin{axis} \addplot coordinates { (1950,3) (1969,2.80) (1969,2.80) }; \end{axis} \end{tikzpicture} But, I'm unable to get the text portion onto the graph (as in the picture above). I mean the labels.
    – Neha
    Aug 12, 2015 at 20:56
  • Thanks @StevenB.Segletes ! But, if you could have a look at my code(previous comment) and help me with it, then that'll be great.
    – Neha
    Aug 12, 2015 at 21:01

1 Answer 1

4

UPDATED Here is how it works, using your more complete data set:

\documentclass{article}
\usepackage{pgfplots}

\begin{document}
\centering
    \begin{tikzpicture}
    \begin{axis}[
      width=\textwidth,
      height=.8\textwidth,
      axis lines=center,
      xmin=1950,
      xmax=1990,
      xticklabel style={/pgf/number format/1000 sep=},
      ymin=2.35,
      ymax=3,
    ]
        \addplot coordinates { (1950,3) (1968,3) (1969,2.80) (1978,2.796) (1979,2.78) (1981,2.548) (1982,2.517) (1984,2.496) (1986,2.479) (1989,2.367)};
        \end{axis}
        \node at (3,7.8){naive};
        \node at (4,5.8){Strassen};
        \node at (6.8,6){Pan};
        \node at (8.5,5.5){Bini et al.};
        % etc.....

\end{tikzpicture}
\end{document}

enter image description here

3
  • How could I change the scale on the x-axis and y-axis? Here's the data: (1950,3) (1969,2.80) (1978,2.796) (1979,2.78) (1981,2.548) (1982,2.517) (1984,2.496) (1986,2.479) (1989,2.376) . With the above code, I get a really cramped figure. The scale used in the picture attached to my original question, makes the graph look a bit neater. How could I do so?
    – Neha
    Aug 13, 2015 at 19:02
  • @user82698 change ymin=0 to ymin=2.35 Aug 13, 2015 at 19:14
  • 1
    @cfr I had read about that but forgot - changed now to article.
    – vaettchen
    Aug 14, 2015 at 10:11

You must log in to answer this question.

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