So I made this graph, and this graph can't show me the tick $\frac{5}{2}\pi$
at 7.85
.
I've tried to enlarge the x
max range, give extra ticks (and extra tick label) but nothing works. Anyone can help me? Thanks!
\documentclass[10pt,openany,a4paper]{article}
\usepackage[margin=1.5cm]{geometry}
\usepackage{a4wide}
\usepackage{amsfonts,amsmath,amssymb}
\usepackage{array}
\usepackage{tikz}
\usepackage{pgf}
\usepackage{pgfplots}
\pgfplotsset{compat=1.13}
\usepackage{mathrsfs}
\usetikzlibrary{arrows}
\usetikzlibrary{calc,angles,positioning,intersections,quotes,decorations.markings}
\usepackage{tkz-euclide}
\usepackage[utf8]{inputenc}
\usepackage{xcolor}
\usepackage[english]{babel}
\begin{document}
\begin{tikzpicture}
\begin{axis} [
axis line style = thick,
axis x line = middle,
axis y line = middle,
xtick = {-3.14, -1.57, 0., ..., 7.85, 9.42},
ytick = {-1, 0, 1},
xlabel = {$\theta$},
ylabel = {$y$},
xticklabels = {$-\pi$, $-\frac{\pi}{2}$, , $\frac{\pi}{2}$, $\pi$, $\frac{3\pi}{2}$, $2\pi$, $\frac{5\pi}{2}$, $3\pi$},
xmin = -3.5, xmax = 10,
ymin = -1.5, ymax = 1.5,
font = \tiny,
]
\addplot[black, thin, samples = 1000, smooth, domain=-3.14:0] {cos(deg(x))};
\addplot[cyan, thin, samples = 1000, smooth, domain=0:3.140000] {cos(deg(x))};
\addplot[black, thin, samples = 1000, smooth, domain=3.14:8.5] {cos(deg(x))};
\end{axis}
\end{tikzpicture}
\end{document}
xtick={...}
withxtick={-3.14,-1.57,...,9.42}
works for me (which avoids the rounding errors).