5

I am trying to do something like this:

enter image description here

Putting some code together gathered from the net gets me nowhere!

\documentclass{standalone}
\usepackage{amsmath}
\usepackage{pgfplots}
\pgfplotsset{trig format plots=rad}
\pgfplotsset{compat=1.12}
\begin{document}
\begin{tikzpicture}[
   % /pgfplots/y=2cm, /pgfplots/x=0.1mm % To make sure all the plots use the same scale
]

%%%%%%
\begin{axis}[
anchor=origin,
 rotate around={0:(current axis.origin)},
 xmin=0, ymin=0, clip=false, % We only want the positive y axis, hence `ymin=0`. `clip=false` is necessary so we can still see the negative component
    axis lines*=center, % Axis lines going through the origin
    xtick=\empty, ytick=\empty, % No tick marks
    enlarge y limits={upper, value=5} % Make the y axis a bit longer than necessary
]
\addplot [thick, red, domain=0.4*pi:0.5*pi,samples= 200] {(cos(5*x^2)*exp(-(x-1.4*pi)^2/0.3)};
\end{axis} %{(cos(5*x^2)*exp(-(x-1.4*pi)^2/0.3)};
%%%%%

\begin{axis}[
hide axis,
%grid
]
\addplot [ultra thick, magenta, domain=-0.2*pi:0.15*pi,samples= 100] {9*sin(5*x)+30};
\addplot [ thick, blue, domain=-0.05*pi:0.05*pi,samples= 300] {(3*cos(25*x)^2*exp(-x^2/0.01)-9};
\end{axis}

\end{tikzpicture}
\end{document}

Any suggestions? Thx in advance

koleygr
  • 20,105
Darwin
  • 71

1 Answers1

6

Here is an answer with somehow automated way using let syntax for coordinates and intersections for the calculations:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{intersections,calc}

\begin{document}
\begin{tikzpicture}[scale=2]
\draw[->] (0,0)--(4,0) node[below] {$t$};
\path[name path=Vert,draw,->] (4.5,1)--(4.5,3) node[below,rotate=90] {$\Delta p(r,t)$};
\path[draw,name path=Horiz,->] (0,0)--(0,1.5) node[midway,left] (A){};
\node[rotate=90,font=\small] at (A) {XUV-Something};
\draw[thick,name path=Func,draw,domain=-0.2:2.25,smooth,variable=\x,samples=50] plot ({\x},{2.3-0.7*sin(\x/2.7*360)});
\node[font=\small] at (0.8,2.3) {$eA_{THz}(t)$};

\foreach \WaveL[count=\i from 0] in {0.03,0.06,0.57,0.07,1.1,0.18,0.24,0.02}{
\path[name path=Vert\i] ({1+\i*0.15/2},0)--({1+\i*0.15/2},6);
\path[name intersections={of=Func and Vert\i}] node at (intersection-1)(PointA\i){};

\path[name path=Horiz\i] let \p1=(PointA\i) in(\x1,\y1)--(4.5,\y1) node[inner sep=0] (PointB\i){};
\node (SWav\i) at ($(PointB\i)-(\WaveL,0)$){} ;
\ifnum\i>0
\pgfmathsetmacro\ev{\i/2-int(\i/2)}
\ifdim\ev pt=0.0 pt %
\draw[dotted] (PointA\i)--({1+\i*0.15/2},\WaveL);
\draw[dotted] (PointA\i)--($(PointB\i)-(\WaveL,0)$);
\fi
\fi
\coordinate (Wav\i) at ({1+\i*0.15/2},\WaveL);
}
\draw[blue,thick] plot[smooth] coordinates {(Wav0)(Wav1)(Wav2)(Wav3)(Wav4)(Wav5)(Wav6)(Wav7)};
\draw[red,thick] plot[smooth] coordinates {(SWav0)(SWav1)(SWav2)(SWav3)(SWav4)(SWav5)(SWav6)(SWav7)};
\end{tikzpicture}
\end{document}

Output:

enter image description here

Please if my question is ok for your request change your title, because it is not really a rotation and could not be drawn by rotation in general, because the distances are changing in case we are not in "45 degrees reflection" from horizontal to vertical as you can see in my figure.

koleygr
  • 20,105
  • I have yet anouther picture of the same 'nature' but i dont seem to get it right. The picture is shown in the following link (https://ibb.co/j3vQyG). The second curve on top is not going where it should be... – Darwin Nov 06 '17 at 14:14
  • @Darwin sorry, but I am repairing my pc these days and I have no time. Please open a new subject because it is a different question – koleygr Nov 07 '17 at 17:42