May be this is what you want:
\documentclass[border=5pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows}
\begin{document}
\begin{tikzpicture}
[x={(0.866cm,-0.5cm)}, y={(0.866cm,0.5cm)}, z={(0cm,1cm)}, scale=1.0,
%Option for nice arrows
>=stealth, %
inner sep=0pt, outer sep=2pt,%
axis/.style={thick,->},
wave/.style={thick,color=#1,smooth},
polaroid/.style={fill=black!60!white, opacity=0.3},]
% Colors
\colorlet{darkgreen}{green!50!black}
\colorlet{lightgreen}{green!80!black}
\colorlet{darkred}{red!50!black}
\colorlet{lightred}{red!80!black}
% Frame
\coordinate (O) at (0, 0, 0);
\draw[axis] (O) -- +(14, 0, 0) node [right] {x};
\draw[axis] (O) -- +(0, 14, 0) node [right] {y};
\draw[axis] (O) -- +(0, 0, 14) node [above] {z};
\draw[thick,dashed] (-2,0,0) -- (O);
% Electric field vectors
\draw[wave=blue, variable=\x,samples at={0,0.25,...,10}]
plot (\x,{sin(2*\x r)},0)node[anchor=north]{$\vec{E}$};
\draw[wave=red, variable=\y,samples at={0,0.25,...,10}]
plot ({sin(2*\y r)},\y,0)node[anchor=north]{$\vec{E}$};
\draw[wave=green, variable=\z,samples at={0,0.25,...,10}]
plot (0,{sin(2*\z r)},\z)node[anchor=north]{$\vec{E}$};
\end{tikzpicture}
\end{document}
Explanation
When you plot (\x,{sin(2*\x r)},0)
, tikz plots sin(2*\x r)
in the xy
plane (in x-
direction) and z
is zero always. Say you want to plot the funtion in xy
plane (in y-
direction) and keeping z
zero, then you have to use ({sin(2*\y r)},\y,0)
. Similarly for yz
plane with x=0
. Now you can try to change the planes in which the graph is plotted. For example, we want sine wave in y
direction and lying in yz
plane. Then you should use
\draw[wave=red, variable=\y,samples at={0,0.25,...,10}]
plot (0,\y,{sin(2*\y r)})node[anchor=north]{$\vec{E}$};
which will give
Here's one possibility using "pure" TikZ:
The image was produced using simply
\begin{tikzpicture}
\RectTri{(0,3)}{(1,0)}{6cm}
\begin{scope}[xshift=8.5cm]
\RectTri[black]{(0,0)}{(4,2)}{4cm}
\end{scope}
\end{tikzpicture}
\RectTri
has three mandatory arguments; the first two are the coordinates for the vertices of one of the legs and the third one is the length of the second leg. The optional argument lets you customize the style used to draw the triangle.
The code:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc,angles,quotes,decorations.markings}
\newcommand\RectTri[4][thick,green!50!black,text=black]{%
\coordinate [label=left:$C$] (C) at #2;
\coordinate [label=below right:$B$] (B) at #3;
\coordinate (aux) at ($ #2 ! 1 ! 90:#3 $);
\coordinate [label=above:$A$] (A) at ($ #2 !#4!(aux) $);
\coordinate (perp) at ($(A)!(C)!(B)$);
\draw[purple!70!black,thick,dashed] (C) -- (perp);
\draw[#1]
(C) --
node[auto] {$b$} (A) --
node[auto] {$c$} (B) --
node[auto] {$a$}
(C)
pic ["$\alpha$",draw,cyan,thick,angle radius=1cm] {angle = C--A--B}
pic ["$\alpha$",draw,cyan,thick,angle radius=1cm] {angle = B--C--perp}
pic ["$\beta$",draw,orange!70!black,thick,angle radius=1cm] {angle = A--B--C}
pic ["$\beta$",draw,orange!70!black,thick,angle radius=1cm] {angle = perp--C--A};
}
\begin{document}
\begin{tikzpicture}
\RectTri{(0,3)}{(1,0)}{6cm}
\begin{scope}[xshift=8.5cm]
\RectTri[black]{(0,0)}{(4,2)}{4cm}
\end{scope}
\end{tikzpicture}
\end{document}
And here's an approach using tkz-euclide
:
\documentclass{article}
\usepackage{tkz-euclide}
\usetkzobj{all}
\begin{document}
\begin{tikzpicture}
\tkzDefPoint(0,1){A}
\tkzDefPoint(2,4){C}
\tkzDefPointWith[orthogonal normed,K=7](C,A)
\tkzGetPoint{B}
\tkzLabelPoint[left](A){$A$}
\tkzLabelPoint[right](B){$B$}
\tkzLabelPoint[above](C){$C$}
\tkzMarkRightAngle(A,C,B)
\tkzDrawSegment[green!60!black](A,C)
\tkzDrawSegment[green!60!black](C,B)
\tkzDrawSegment[green!60!black](B,A)
\tkzLabelSegment[auto](B,A){$c$}
\tkzLabelSegment[auto,swap](B,C){$a$}
\tkzLabelSegment[auto,swap](C,A){$b$}
\tkzDrawAltitude[dashed,color=magenta](A,B)(C)
\tkzGetPoint{D}
\tkzMarkAngle[size=1cm,color=cyan,mark=|](C,B,A)
\tkzMarkAngle[size=1cm,color=cyan,mark=|](A,C,D)
\tkzMarkAngle[size=0.75cm,color=orange,mark=||](D,C,B)
\tkzMarkAngle[size=0.75cm,color=orange,mark=||](B,A,C)
\end{tikzpicture}
\end{document}
Best Answer
Like this?