tikz图像填充问题

2019-12-03 23:38发布

``` \documentclass{standalone} \usepackage{tikz,amsmath,osno} \usetikzlibrary{patterns} \begin{docum...

``` \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条回答
就不能把代码放到代码块里么? ```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} ```

一周热门 更多>