``` \documentclass{standalone} \usepackage{tikz,amsmath,osno} \usetikzlibrary{patterns} \begin{document} \begin{tikzpicture} \draw -latex,thick—(4,0) node [below] {\large $x$}; \draw -latex,thick—(0,5) node [left] (0,5) {\large $y$}; \draw [smooth,very thick, domain=-2.5:2.5] plot (\x, {0.5\x\x}); \draw [smooth,very thick, domain=-5:1] plot (\x, {0.5*(\x+2)^2-2}); \foreach \x in{-5,-4,-3,-2,-1,0,1,2,3 }{ \draw (\x,0.15)—(\x,0); } \foreach \y in{-4,-3,-2,-1,0,1,2,3,4}{ \draw (0.15,\y)—(0,\y); } \draw [thick,densely dashed] (-2,4)—(-2,-3); \node [below right] at (0,0) {\large $O$}; \end{tikzpicture} \end{document} ``` ![](https://pics.latexstudio.net/data/images/201912/c187fe1997537f5.jpg)

3 回答3

1
就不能把代码放到代码块里么? ```tex \documentclass{standalone} \usepackage{tikz,amsmath} \usetikzlibrary{patterns} \begin{document} \begin{tikzpicture} \draw [-latex,thick](-5.5,0)--(4,0) node [below] {\large $x$}; \draw [-latex,thick](0,-4.5)--(0,5) node [left] {\large $y$}; \draw [smooth,very thick, domain=-2.5:2.5] plot (\x, {0.5*\x*\x}); \draw [smooth,very thick, domain=-5:1] plot (\x, {0.5*(\x+2)^2-2}); \foreach \x in{-5,-4,-3,-2,-1,1,2,3 }{ \draw (\x,0.15)--(\x,0)node[below]{$\x$}; } \foreach \y in{-4,-3,-2,-1,1,2,3,4}{ \draw (0.15,\y)--(0,\y)node[left]{$\y$}; } \draw [thick,densely dashed] (-2,4)--(-2,-3); \node [below right] at (0,0) {\large $O$}; \fill[gray,opacity=0.6](0,0) parabola (-2,2)--(-2,-2) parabola(0,0); \node at (-2,2) [left]{$Q$}; \node at (-2,-2)[below left]{$P$}; \end{tikzpicture} \end{document} ```
  • 桔子大哥,我就太佩服了。 – chaisu 2019-12-04 22:15 回复
0
参考[如何用tikz填充不规则图形的颜色](https://wenda.latexstudio.net/q-1341.html "如何用tikz填充不规则图形的颜色")
0
看看这个贴子里给出的链接:[https://wenda.latexstudio.net/article-5035.html](https://wenda.latexstudio.net/article-5035.html "https://wenda.latexstudio.net/article-5035.html") 也许对你的问题有帮助。

你的回答

请登录后回答

你的回答将会帮助更多人,请务必认真回答问题。