答案1
像这样:
代码:
\documentclass[border=5pt]{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\draw[gray!40,dashed] (-9,-1) grid (5,8); % coordinate grid
\draw[->] (-9,0) -- (5,0) node[right] {$x$}; % x-axis
\draw[->] (0,-1) -- (0,8) node[above] {$y$}; % y-axis
\foreach \x in {-8,...,-1,1,2,...,5} % x-axis labels
\draw (\x,2pt) -- (\x,-2pt) node[anchor=north, font=\footnotesize] {$\x$};
\foreach \y in {-1,1,2,...,8} % y-axis labels
\draw (2pt,\y) -- (-2pt,\y) node[anchor=east, font=\footnotesize] {$\y$};
\node at (-.3,-.3) () {$O$};
\draw[<->,magenta,line width=3pt] plot[domain=-8.2:4.2,smooth,samples=101] (\x,{.125*(\x+2)^2+3});
\draw[red,dashed,line width=1pt] (-2,-1)--(-2,8) node[pos=.9,sloped,fill=white] () {axis: $x=-2$};
\draw[red,dashed,line width=1pt] (-9,1)--(5,1) node[pos=.8,fill=white] () {directrix: $y=1$};
\fill[blue] (-2,3) circle(.1) node[red,below] {\scriptsize Vertex (-2,3)};
\fill[blue] (-2,5) circle(.1) node[red,below] {\scriptsize Focus (-2,5)};
\node[red,fill=white] at (3,6) () {$(x+2)^2=8(y-3)$};
\end{tikzpicture}
\end{document}