答案1
和tkz-fct / TikZ
\documentclass{standalone}
\usepackage{tkz-fct}
\begin{document}
\begin{tikzpicture}[scale=2] \tkzInit[xmax=2,ymax=4]
\tkzGrid \tkzAxeXY
\tkzFct[color = red,thick, domain =0:2]{x*x}
\tkzDrawTangentLine[draw, kl = 0.8, kr = 0.8](0)
\tkzDrawTangentLine[draw, kl = 0.8,kr = 0.8 ](1)
\end{tikzpicture}
\end{document}
答案2
答案3
尝试这个(使用 TikZ):
\documentclass[a4paper]{article}
\usepackage{tikz}
\begin{document}
\centering
\begin{tikzpicture}[line width=3pt,scale=1.5]
\draw [gray!10,line width=.3pt] (-3,-1) grid (3,5);
\draw [->,style=thick] (-3.2,0) -- (3.3,0) node[pos=1,right] {$x$};
\foreach \x in {-3,...,3} \draw[thick] (\x,-0.05) to (\x,0.05) node[black,below] at (\x,-0.05) {$\x$};
\draw [->,style=thick] (0,-1.20) -- (0,5) node[pos=1,right] {$y$};
\foreach \x in {-1,...,5} \draw[thick] (-0.05,\x) to (0.05,\x) node[black,left] at (-0.05,\x) {$\x$};
\draw [cyan, domain=-2.2:2.2, samples=50] plot (\x, {\x*\x }); %parabola
\draw [magenta, domain=0:3, samples=50] plot (\x, {2*\x- 1}); % tangent in x=1
\end{tikzpicture}
\end{document}