
Meine Aufgabe ist ganz einfach. Ich möchte meiner 3D-Achsenzeichnung ein 2D-Diagramm hinzufügen. Mein Endergebnis ist folgendes:
\begin{tikzpicture}
\begin{axis}[
axis equal,
view={45}{30},
compat=1.8,
height=10.2cm,
width=9cm,
grid=major,
grid style={dashed, gray!50},
axis lines=middle,
inner axis line style={=>},
yticklabel style={inner ysep=0pt, anchor=south east, font=\tiny},
ytick={-1,...,1},
xticklabel style={inner xsep=0pt, anchor=north west, font=\tiny},
xtick={-1,...,1},
zticklabel style={inner ysep=0pt, anchor=south east, font=\tiny},
ztick={-1,...,1},
ymin=-2,
ymax=2,
xmin=-2,
xmax=2,
zmin=-2,
zmax=2]
\addplot+[color=PlotColorOne, samples=30, domain=0:2*pi, thick, smooth, z=0] ({sin(deg(x))},{cos(deg(x))});
\end{axis}
\end{tikzpicture}
Das Ergebnis ist:
Wie ist es möglich, die Z-Koordinate auf 0 zu setzen?
Antwort1
Sie können das gewünschte 2D-Diagramm einfach als 3D-Diagramm behandeln z=0
. Verwenden Sie also
\addplot3 ({sin(deg(x))},{cos(deg(x))},0)`
du erhältst:
Code:
\documentclass[border=2pt]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
axis equal,
view={45}{30},
compat=1.8,
height=10.2cm,
width=9cm,
grid=major,
grid style={dashed, gray!50},
axis lines=middle,
inner axis line style={=>},
yticklabel style={inner ysep=0pt, anchor=south east, font=\tiny},
ytick={-1,...,1},
xticklabel style={inner xsep=0pt, anchor=north west, font=\tiny},
xtick={-1,...,1},
zticklabel style={inner ysep=0pt, anchor=south east, font=\tiny},
ztick={-1,...,1},
ymin=-2,
ymax=2,
xmin=-2,
xmax=2,
zmin=-2,
zmax=2]
\addplot3[color=red, samples=30, domain=0:2*pi, thick, smooth, z=0] ({sin(deg(x))},{cos(deg(x))},0);
\end{axis}
\end{tikzpicture}
\end{document}