TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

everyone!

I have got a little problem trying to draw in LaTeX.

Let me try to explain: I have a xyz-axis, as you can see on the figure below.

enter image description here

Plotting any 2-D data point graph in the xy-axis:

\begin{filecontents}{data.dat}
0 0
1 1
2 4
\end{filecontents}

\begin{document}

\begin{tikzpicture}[scale=1]

\draw[thick,->,black] (0,0,0) -- (2,0,0) node[anchor=west]{$x$};
\draw[thick,->] (0,0,0) -- (0,4.5,0) node[anchor=east]{$y$};
\draw[thick,->] (0,0,0) -- (0,0,1) node[anchor=east]{$z$};

\draw[smooth] plot file {data.dat};

\end{tikzpicture}

Resulting:

enter image description here

The problem is: I cannot plot a similar graph just in the zy-axis.

Any idea how to do it?

Thanks a lot!

share|improve this question
up vote 1 down vote accepted

This solution uses tikzlibrary 3d which makes it easier to draw 2d datum with 3d coordinates.

enter image description here

Code:

\documentclass[border=10pt]{standalone}
\usepackage{tikz}
\usepackage{filecontents}
\usetikzlibrary{3d}

\begin{document}

\begin{filecontents}{data.dat}
0 0 
1 1 
2 4 
\end{filecontents}

\begin{tikzpicture}
\draw[thick,->,black] (0,0,0) -- (2,0,0) node[anchor=west]{$x$};
\draw[thick,->] (0,0,0) -- (0,4.5,0) node[anchor=east]{$y$};
\draw[thick,->] (0,0,0) -- (0,0,2) node[anchor=east]{$z$};
\begin{scope}[canvas is xy plane at z=0]
      \draw [smooth] plot file {data.dat};
\end{scope}
\begin{scope}[canvas is xz plane at y=0]
      \draw [smooth] plot file {data.dat};
\end{scope}
\begin{scope}[canvas is yz plane at x=0]
      \draw [smooth] plot file {data.dat};
\end{scope}
\end{tikzpicture}
\end{document}
share|improve this answer
    
Perfect, @Jesse ! It was exactly what I needed! Thank you very much! – user44331 Jan 18 '14 at 20:27

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.