# drawing two curves in the same figure

Please i need someone who can help me to draw two curves into one figure. I need to draw the two curves Y1 and Y2 in the same figure.

By the way, i tried to write the code below:

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

\begin{tikzpicture}

\draw[->] (0,0) -- (6,0);
\draw[->] (0,0) -- (0,1.5);

\draw[thick, color=red] plot [smooth,tension=0] coordinates{(0.1, 0.003) (0.5, 0.005) (2, 0.4) (5, 1)};
\draw[thick, color=red] plot [smooth,tension=0] coordinates{(0.1, 0.2) (0.5, 0.5) (2, 0.1) (5, 1.4)};

\end{tikzpicture}
\end{document}


The problem is that i get a very small graph especially a very small y-axis!! so how can i resolve this problem ?

• Welcome to TeX.SX. Questions about how to draw specific graphics are really not reasonable questions to ask on the site. Please post a minimal compilable document showing what you've tried to produce the image and then people will be happy to help you with any specific problems you may have. See minimal working example (MWE) for what needs to go into such a document. Have you tried using the pfgplotstable package? – jub0bs Nov 9 '13 at 21:04
• ah okk, thank you so much for your response anyway, i will delete my question and post another one with some codes :) – Christina Nov 9 '13 at 21:07
• Don't delete it. Simply edit and improve it. – jub0bs Nov 9 '13 at 21:07
• ah ok i will :) – Christina Nov 9 '13 at 21:07

You can use additionaly the pgfplots package.

The first way is using the coordinates directly in the code to produce the graphic.

\documentclass{article}
\usepackage{tikz,pgfplots}

\begin{document}
\begin{tikzpicture}
\begin{axis}[%
axis x line=bottom,
axis y line=left]
\addplot[mark=none,red,thick] coordinates {(0.1, 0.003) (0.5, 0.005) (2, 0.4) (5, 1)};
\addplot[mark=none,red,thick] coordinates {(0.1, 0.2) (0.5, 0.5) (2, 0.1) (5, 1.4)};
\end{axis}
\end{tikzpicture}
\end{document}


The second way is use a table, from a .dat file.

\documentclass{article}
\usepackage{tikz,pgfplots}

\begin{document}
\begin{tikzpicture}
\begin{axis}[%
axis x line=bottom,
axis y line=left]
\end{axis}
\end{tikzpicture}
\end{document}


The table.dat file is a text document (you can create it with notepad), and the data is written inside it, in columns, like this:

x   y1  y2
0.1 0.003   0.2
0.5 0.005   0.5
2   0.4 0.1
5   1   1.4


Every data is tab-separated.

Both schemes produce this:

In addition, you can describe a legend and labels for both axis.

\documentclass{article}
\usepackage{tikz,pgfplots}

\begin{document}
\begin{tikzpicture}
\begin{axis}[%
axis x line=bottom,
axis y line=left,
xlabel=$X$,
ylabel=$Y$,
legend pos= south east]
\legend{$Y_1$,$Y_2$};
\end{axis}
\end{tikzpicture}
\end{document}


The result:

• Sincerely, i don't know how to thank you Dear!! thank you sooooo much – Christina Nov 9 '13 at 22:19

Alternative option:

\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[scale=1.5]
\draw[->] (0,0) -- (5.5,0) node[right] {$x$}; % x-axis
\draw[->] (0,0) -- (0,2) node[above] {$y$}; % y-axis
\foreach \x in {0,0.5,...,5}
\draw[xshift=\x cm] (0pt,1pt) -- (0pt,-1pt) node[below] {$\x$};
\foreach \y in {0, 0.5, 1, 1.5}
\draw[yshift=\y cm] (1pt,0pt) -- (-1pt,0pt) node[left] {$\y$};
\draw[thick, color=red] plot [smooth,tension=0] coordinates{(0.1, 0.003) (0.5, 0.005) (2, 0.4) (5, 1)} node[right, color=black] {$Y_1$};
\draw[thick, color=blue] plot [smooth,tension=0] coordinates{(0.1, 0.2) (0.5, 0.5) (2, 0.1) (5, 1.4)} node[right, color=black] {$Y_2$};
\end{tikzpicture}
\end{document}


The following changes the plotting scale.

\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}

\draw[->] (0,0) -- (6,0);
\draw[->] (0,0) -- (0,1.5);

\draw[thick, color=red] plot [smooth,tension=0] coordinates{(0.1, 0.003) (0.5, 0.005) (2, 0.4) (5, 1)};
\draw[thick, color=red] plot [smooth,tension=0] coordinates{(0.1, 0.2) (0.5, 0.5) (2, 0.1) (5, 1.4)};

\end{tikzpicture}
\vskip3ex
\begin{tikzpicture}[x=1.5cm,y=2.0cm]

\draw[->] (0,0) -- (6,0);
\draw[->] (0,0) -- (0,1.5);

\draw[thick, color=red] plot [smooth,tension=0] coordinates{(0.1, 0.003) (0.5, 0.005) (2, 0.4) (5, 1)};
\draw[thick, color=red] plot [smooth,tension=0] coordinates{(0.1, 0.2) (0.5, 0.5) (2, 0.1) (5, 1.4)};

\end{tikzpicture}
\end{document}


• Thank you so much for your reply :) i really appreciated it :) – Christina Nov 9 '13 at 22:18