I am providing the code for graphing three trigonometric functions. (In the preamble, I had to put a %
before the command \usetikzlibrary{calc,angles,quotes}
because LaTeX could not compile it with the command. It gave me the error can't find file 'tikzlibraryangles.code.tex'
. MikTeX2.9 is compiling the code.) How do I add the labels "$\scriptstyle{y = \sin(x)}," "$\scriptstyle{y = \cos(x)}," and "$\scriptstyle{y = \tan(x)}" directly under the y-axis to the corresponding graphs? Arrowheads should be at both ends of the axes. They are currently at one end. Is there a code for putting labels (in nodes) for the tick marks over other features of the graphs? How does the code instruct TikZ to marks the tick marks in half-unit increments? How do I get the code to instruct TikZ to mark the tick marks in increments of integral multiples of \pi/2? In the graphs of the tangent function, the asymptotes are solid lines. How do I get dotted lines? In the code for graphing the tangent function, there is "scaled x ticks={real:3.1415}, xtick scale label code/.code={}". What does "{real:3.1415}" and "code/.code={}" instruct TikZ to draw on the x-axis?
\documentclass{article}
\usepackage{amsmath}
\usepackage{tikz}
%\usetikzlibrary{calc,angles,quotes}
\usepackage{pgfplots}
\pgfkeys{/pgfplots/Axis Style/.style={
width=13.5cm, height=5cm,
axis x line=center,
axis y line=middle,
samples=100,
ymin=-1.5, ymax=1.5,
xmin=-7.0, xmax=7.0,
domain=-2*pi:2*pi
}}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
Axis Style,
xtick={
-6.28318, -4.7123889, -3.14159, -1.5708,
1.5708, 3.14159, 4.7123889, 6.28318
},
xticklabels={
$-2\pi$, $-3\pi/2$, $-\pi$, $\pi/2$,
$\pi/2$, $\pi$, $3\pi/2$, $2\pi$
}
]
\addplot [mark=none, ultra thick, blue] {sin(deg(x))};
\end{axis}
\end{tikzpicture}
\begin{tikzpicture}
\begin{axis}[
Axis Style,
xtick={
-6.28318, -4.7123889, -3.14159, -1.5708,
1.5708, 3.14159, 4.7123889, 6.28318
},
xticklabels={
$-2\pi$, $-3\pi/2$, $-\pi\hspace{0.30cm}$, $\pi/2$,
$\pi/2$, $\pi\hspace{0.10cm}$, $3\pi/2$, $\hspace{0.25cm} 2\pi$
}
]
\addplot [mark=none, ultra thick, red] {cos(deg(x))};
\end{axis}
\end{tikzpicture}
\begin{tikzpicture}
\begin{axis}[
Axis Style,
xtick={-6.28318, -4.7123889, ..., 6.28318},
scaled x ticks={real:3.1415},
xtick scale label code/.code={},
]
\addplot [mark=none, thin, brown] {tan(deg(x))};
\end{axis}
\end{tikzpicture}
\end{document}
pgfplots
manual has answers to your questions and much, much more.