How to create simple graph in latex. x,y axis with straight line drawn at (0,0) at 45 degress through the x,y axis.
The graphs here are excellent but just too complicated for newcommers.
here is the link
How to create simple graph in latex. x,y axis with straight line drawn at (0,0) at 45 degress through the x,y axis.
The graphs here are excellent but just too complicated for newcommers.
here is the link
You can use TikZ
(the manual is really great and it has numerous examples; there's also a Minimal introduction to TikZ):
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[scale=3]
\draw[->] (-1,0) -- (1,0) node[right] {$x$};
\draw[->] (0,-1) -- (0,1) node[above] {$y$};
\draw[blue] +(225:1.4) -- +(45:1.4);
\end{tikzpicture}
\end{document}
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\draw[->] (0,0) -- (5,0);
\draw[->] (0,0) -- (0,5);
\draw[blue] (0,0) -- +(45:7);
\foreach \i/\text in {1.4/year,2.8/age,4.2/type,5.6/speed}
\draw[fill=white,draw=blue] (45:\i) circle (2pt) node[left,xshift=-2pt] at (45:\i) {\text};
\node[anchor=west] at (0,-10pt) {Colour};
\node[anchor=east] at (5,-10pt) {Make};
\node[anchor=east,text width=1cm,align=left] at (-10pt,10pt) {Engine};
\node[anchor=east,text width=1cm,align=left] at (-10pt,4.8) {Car};
\end{tikzpicture}
\end{document}
For plotting functions or data, pgfplots
which is based on TikZ, is useful. A simple example is given below, and the manual has many more.
\documentclass{standalone}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[axis lines=center]
\addplot [mark=none] {x};
\end{axis}
\end{tikzpicture}
\end{document}