# Fourier Spectrum conversion from 3D to 2D

I am delighted to have the link ORIGINAL LINK However, I have modified the graph to suit my purpose but it's still in xyz-plane. Actually, I want to have the same graph in xy-plane. My MWE is as follows:

\documentclass{article}
% -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
\usepackage{tikz}
\usepackage{graphicx}
% very useful for disposing off the white spaces from a page
\usepackage[active,tightpage]{preview}
% to be used with \usepackage{preview}
\PreviewEnvironment{tikzpicture}
% -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
\begin{document}
% -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
\begin{tikzpicture}[x={(1cm,1cm)},y={(1cm,0.0cm)},z={(0cm,0.6cm)}]
\tiny
% body of the graph
\draw [blue, domain=0.25*pi:0.5*pi,samples=100,smooth]
plot (0,\x, {sin(4*0.5*\x r)/0.5 + sin(4*1.5*\x r)/1.5 + sin(4*2.5*\x r)/2.5} );
\draw [blue, domain=1*pi:1.5*pi,samples=100,smooth]
plot (0,\x-1.573, {sin(4*0.5*\x r)/0.5 + sin(4*1.5*\x r)/1.5 + sin(4*2.5*\x r)/2.5} );
\draw [blue, domain=1*pi:1.5*pi,samples=100,smooth]
plot (0,\x-0.0, {sin(4*0.5*\x r)/0.5 + sin(4*1.5*\x r)/1.5 + sin(4*2.5*\x r)/2.5} );
% draw axis
\draw[->,black!70] (0,0.25*pi,0) -- (0,6,0) node[below] {$\omega'$};
\draw[->,black!70] (0,0.25*pi,0) -- (0,0.25*pi,3) node[above] {$\left|w\left(e^{j\omega'}\right)\right|$};
% draw axis label
\draw[black!70] (0,0.25*pi,0) node[below] {$0$};
\draw[black!70] (0,0.5*pi,0) node[below] {$\pi/L$};
\draw[black!70] (0,1.0*pi,0) node[below] {$3\pi/L$};
\draw[black!70] (0,1.5*pi,0) node[below] {$\pi$};
\end{tikzpicture}
% -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
\end{document}

-

Some thing like this?

\documentclass[border=5mm]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.8}

\begin{document}
\begin{tikzpicture}
\begin{axis}[
set layers=standard,
domain=0:10,
samples y=1,
view={0}{0},    %%%<-------- changed this
hide axis,
unit vector ratio*=1 2 1,
xtick=\empty, ytick=\empty, ztick=\empty,
clip=false
]
\def\sumcurve{0}
\pgfplotsinvokeforeach{0.5,1.5,...,5.5}{
\draw [on layer=background, gray!20] (axis cs:0,#1,0) -- (axis cs:10,#1,0);
\addplot3 [on layer=main, blue!30, smooth, samples=101] (x,#1,{sin(#1*x*(157))/(#1*2)});

\addplot3 [on layer=axis foreground, very thick, blue,samples=2] (10.5,#1,{1/(#1*2)});     %%5 remove ycomb from options.
\xdef\sumcurve{\sumcurve + sin(#1*x*(157))/(#1*2)}
}

\draw [on layer=axis foreground]  (axis cs:0,0,0) -- (axis cs:10,0,0);
\draw (axis cs:10.5,0.25,0) -- (axis cs:10.5,5.5,0);
\end{axis}
\end{tikzpicture}
\end{document}


Coming to your mwe, you have to interchange the x and z values i.e, make z-values zero and use only x and y like (x,y,0). Instead of

(0,\x-1.573, {sin(4*0.5*\x r)/0.5 + sin(4*1.5*\x r)/1.5 + sin(4*2.5*\x r)/2.5} );


use

(\x-1.573, {sin(4*0.5*\x r)/0.5 + sin(4*1.5*\x r)/1.5 + sin(4*2.5*\x r)/2.5},0 );


We get

\documentclass[tikz,border=5pt]{standalone}
% -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
\begin{document}
% -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
\begin{tikzpicture}%[x={(0cm,0cm)},y={(1cm,0.0cm)},z={(0cm,0.6cm)}]
\tiny
% body of the graph
\draw [blue, domain=0.25*pi:0.5*pi,samples=100,smooth]
plot (\x, {sin(4*0.5*\x r)/0.5 + sin(4*1.5*\x r)/1.5 + sin(4*2.5*\x r)/2.5+0.8},0 );
\draw [blue, domain=1*pi:1.5*pi,samples=100,smooth]
plot (\x-1.573, {sin(4*0.5*\x r)/0.5 + sin(4*1.5*\x r)/1.5 + sin(4*2.5*\x r)/2.5+0.8},0 );
\draw [blue, domain=1*pi:1.5*pi,samples=100,smooth]
plot (\x-0.0, {sin(4*0.5*\x r)/0.5 + sin(4*1.5*\x r)/1.5 + sin(4*2.5*\x r)/2.5+0.8},0 );
% draw axis
\draw[->,black!70] (0,0.25*pi,0) -- (0,6,0) node[left] {$\omega'$};
\draw[->,black!70] (0,0.25*pi,0) -- (6,0.25*pi,0) node[above] {$\left|w\left(e^{j\omega'}\right)\right|$};
% draw axis label
\draw[black!70] (0,0.25*pi,0) node[left] {$0$};
\draw[black!70] (0,0.5*pi,0) node[left] {$\pi/L$};
\draw[black!70] (0,1.0*pi,0) node[left] {$3\pi/L$};
\draw[black!70] (0,1.5*pi,0) node[left] {$\pi$};
\end{tikzpicture}
% -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
\end{document}


I have also added a factor of +0.8 in the function

sin(4*0.5*\x r)/0.5 + sin(4*1.5*\x r)/1.5 + sin(4*2.5*\x r)/2.5+0.8


to being the curve little up.

-
Thanks a lot. It helped me a lot in understanding the axis commands too! I have added below what I have got from your answer. Thanks once again! –  Khaaba May 14 '14 at 9:46

Here is the new MWE

\documentclass[tikz,border=5pt]{standalone}
% -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
\begin{document}
% -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
\begin{tikzpicture}%[x={(0cm,0cm)},y={(1cm,0.0cm)},z={(0cm,0.6cm)}]
\tiny
% body of the graph
\draw [blue, domain=0.25*pi:0.5*pi,samples=100,smooth]
plot (\x-0.25*pi, {sin(4*0.5*\x r)/0.5 + sin(4*1.5*\x r)/1.5 + sin(4*2.5*\x r)/2.5+0.8} );
\draw [blue, domain=1.0*pi:1.5*pi,samples=100,smooth]
plot (\x-0.75*pi, {sin(4*0.5*\x r)/0.5 + sin(4*1.5*\x r)/1.5 + sin(4*2.5*\x r)/2.5+0.8} );
\draw [blue, domain=1.0*pi:1.5*pi,samples=100,smooth]
plot (\x-0.25*pi, {sin(4*0.5*\x r)/0.5 + sin(4*1.5*\x r)/1.5 + sin(4*2.5*\x r)/2.5+0.8} );
% draw axis
\draw[->,black!70] (0,0.25*pi) -- (0,4); \draw(-0.5,4.5) node[left, rotate=90]     {$\left|W\left(e^{j\omega'}\right)\right|$};
\draw[->,black!70] (0,0.25*pi) -- (6,0.25*pi) node[below] {$\omega'$};
% draw axis label
\draw[black!70] (0.0,0.25*pi) node[below] {$0$};
\draw[black!70] (0.25*pi,0.25*pi) node[below] {$\pi/L$};
\draw[black!70] (0.75*pi,0.25*pi) node[below] {$3\pi/L$};
\draw[black!70] (1.25*pi,0.25*pi) node[below] {$\pi$};
\end{tikzpicture}
% -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
\end{document}


or after removing the factor of 0.8 added by Harish earlier:

\documentclass[tikz,border=5pt]{standalone}
% -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
\begin{document}
% -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
\begin{tikzpicture}
\tiny
% body of the graph
\draw [blue, domain=0.25*pi:0.5*pi,samples=100,smooth]
plot (\x-0.25*pi, {sin(4*0.5*\x r)/0.5 + sin(4*1.5*\x r)/1.5 + sin(4*2.5*\x r)/2.5} );
\draw [blue, domain=1.0*pi:1.5*pi,samples=100,smooth]
plot (\x-0.75*pi, {sin(4*0.5*\x r)/0.5 + sin(4*1.5*\x r)/1.5 + sin(4*2.5*\x r)/2.5} );
\draw [blue, domain=1.0*pi:1.5*pi,samples=100,smooth]
plot (\x-0.25*pi, {sin(4*0.5*\x r)/0.5 + sin(4*1.5*\x r)/1.5 + sin(4*2.5*\x r)/2.5} );
% draw axis
\draw[->,black!70] (0,0) -- (0,3); \draw(-0.5,3.5) node[left, rotate=90]     {$\left|W\left(e^{j\omega'}\right)\right|$};
\draw[->,black!70] (0,0) -- (6,0) node[below] {$\omega'$};
% draw axis label
\draw[black!70] (0.0,0) node[below] {$0$};
\draw[black!70] (0.25*pi,0) node[below] {$\pi/L$};
\draw[black!70] (0.75*pi,0) node[below] {$3\pi/L$};
\draw[black!70] (1.25*pi,0) node[below] {$\pi$};
\end{tikzpicture}
% -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
\end{document}


Here is the output of the above code[Thanks to Harish Kumar]:

-