当前位置:   article > 正文

LaTeX - 填充图中的阴影部分

latex画阴影
  1. % 例1
  2. \documentclass[10pt]{standalone}
  3. \usepackage{tikz}
  4. \usetikzlibrary{arrows.meta}
  5. \usepackage{unicode-math}
  6. \setmainfont{XITS}
  7. \setmathfont{XITS Math}
  8. \usepackage{scalerel} %\scaleobj{1.5}{} 缩放公式大小
  9. \begin{document}
  10. \begin{tikzpicture}[smooth]
  11. \draw[arrows={-Stealth[length=5pt, inset=3.5pt]}] (-0.5,0) -- (3.0,0)node (xaxis) [right=-1pt] {$x$};
  12. \draw[arrows={-Stealth[length=5pt, inset=3.5pt]}] (0,-0.5) -- (0,4.5)node (yaxis) [above=-0.6pt] {$y$};
  13. \draw (-0.18,-0.18) node {$o$};
  14. \draw[color=red,domain=0:2.0,fill=green!20] plot (\x,4*\x-\x*\x);
  15. \draw[color=red!40,domain=0:2.90] plot (\x,4*\x-\x*\x) ;
  16. \draw[color=blue!30,domain=0:2.3] plot (\x,2*\x) ;
  17. \draw[fill=black] (2,4) circle [radius=0.2pt] node[above=-1.8pt] {$\scaleobj{0.8}{A(2,4)}$};
  18. \end{tikzpicture}
  19. \end{document}

  1. % 例2
  2. \documentclass[10pt]{standalone}
  3. \usepackage{tikz}
  4. \usetikzlibrary{arrows.meta}
  5. \usepackage{unicode-math}
  6. \setmainfont{XITS}
  7. \setmathfont{XITS Math}
  8. \begin{document}
  9. \begin{tikzpicture}[yscale=0.7]
  10. \draw[-stealth] (-0.4,0)--(2,0) node[below,scale=0.6]{$x$};
  11. \draw[-stealth] (0,-0.3)--(0,5) node[left,scale=0.6]{$y$};
  12. \draw (0,0) node [below left,scale=0.6] {$o$};
  13. \foreach \i in {1}{\draw (\i,0)--node [below,scale=0.6] {$1$}(\i,0.05);}
  14. \draw (0,1) node [left,scale=0.6] {$1$};
  15. \draw (1.35,1) node [right,scale=0.6] {$l_x$};
  16. \draw (0.4,3.85742) node [above,scale=0.6] {$l_y$};
  17. \draw (1.35,-0.2) -- (1.35,4.25519);
  18. \draw (-0.2,3.85742) -- (1.55,3.85742);
  19. \draw (1.35,3.85742) node [below right,scale=0.6] {$M(x,y)$};
  20. %\clip (-1,-1) rectangle (5,5);%只在这个区域内画图
  21. \draw[domain=1:4,smooth,variable=\t] plot ({ln(\t)+1/(2*\t)-0.5},\t)node[above,scale=0.6] {$C_3$};
  22. \draw[domain=0:1.8,smooth] plot (\x,{0.5*1+0.5*exp(\x)}) node[below right,scale=0.6] {$C_1$};
  23. \draw[domain=0:1.45,smooth] plot (\x,{exp(\x)}) node[below right,scale=0.6] {$C_2$};
  24. \filldraw [fill=gray!20] (0,0) -- plot [domain=0:1.35,smooth] (\x,{exp(\x)}) -- (1.35,0) -- (0,0);
  25. \filldraw [fill=white] (0,0) -- plot [domain=0:1.35,smooth] (\x,{0.5*1+0.5*exp(\x)}) -- (1.35,0) -- (0,0);
  26. \filldraw [fill=gray!40] (0,1) -- plot [domain=0:1.35,smooth] (\x,{exp(\x)}) -- (0,3.85742) -- (0,1);
  27. \filldraw [fill=white] (0,1) -- plot [domain=1:3.85742,smooth,variable=\t] ({ln(\t)+1/(2*\t)-0.5},\t) -- (0,3.85742) -- (0,1);
  28. \end{tikzpicture}
  29. \end{document}

  1. % 例3
  2. \documentclass[tikz,border=0pt,10pt]{standalone}
  3. \usetikzlibrary{arrows.meta}
  4. \usetikzlibrary{patterns}
  5. \definecolor{pink}{RGB}{249,164,186}
  6. \definecolor{grassgreen}{RGB}{128,255,0}
  7. \usepackage{scalerel} %\scaleobj{1.5}{} 缩放公式大小
  8. \begin{document}
  9. \begin{tikzpicture}[scale=1.5]
  10. \draw[-stealth] (-0.3,0) -- (2.2,0)node (xaxis) [right,scale=0.8] {$x$};
  11. \draw[-stealth] (0,-1.6) -- (0,1.6)node (yaxis) [left,scale=0.8] {$y$};
  12. \fill[pink!] (0,0) -- (1,-1) arc [start angle=315, end angle=405, radius=1.414] -- (0,0);
  13. \fill[pink!] (1,0) -- (1,1) arc [start angle=90, end angle=180, radius=1] -- (0,0);
  14. \fill[grassgreen] (0,0) -- (1,-1) arc [start angle=315, end angle=360, radius=1.414] -- (1.414,0)--(2,0) arc [start angle=360, end angle=270, radius=1] -- (1,-1);
  15. \fill[grassgreen] (0,0) -- (1,1) arc [start angle=45, end angle=0, radius=1.414] -- (1.414,0)--(2,0) arc [start angle=0, end angle=90, radius=1] -- (1,1);
  16. \draw (1,-0.02)--(1,0.02) node[below] {$\scaleobj{0.6}{1}$};
  17. \draw (1.414,-0.02)--(1.414,0.02) node[below] {$\scaleobj{0.6}{\sqrt{2}}$};
  18. \draw[style=dashed,color=red,domain=-0.1:1.4] plot(\x,-\x);
  19. \draw[color=black,domain=-0.1:2.2] plot(\x,0);
  20. \draw[style=dashed] (0,0)--(0,-1.414) arc [start angle=270, end angle=450, radius=1.414];
  21. \draw (1,0) circle [radius=1];
  22. %\fill[pattern=north west lines](0,0)--(-2,0)--(-2,2)--(0,2)arc(90:270:0.8);
  23. %\fill[pattern=north west lines]arc(-45:0:1);
  24. \end{tikzpicture}
  25. \end{document}

例4.(by kuing) 选自怎么填充图中的阴影部分

  1. % 例4-1
  2. \documentclass[10pt]{standalone}
  3. \usepackage{tikz}
  4. \usetikzlibrary{arrows.meta}
  5. \usepackage{unicode-math}
  6. \setmainfont{XITS}
  7. \setmathfont{XITS Math}
  8. \begin{document}
  9. \begin{tikzpicture}[scale=15]
  10. \begin{scope}
  11. \clip (0,0) arc (-90:0:1/8) arc (90:180:1/8);
  12. \fill[gray,even odd rule] (0,0) arc (-90:0:1/8) arc (90:180:1/8)
  13. arc (-90:270:1/16) arc (-180:180:1/16) arc (-90:0:1/16) arc (90:180:1/16);
  14. \end{scope}
  15. \draw [-stealth,thick](-0.05,0)--(0.3,0);
  16. \draw [-stealth,thick](0,-0.05)--(0,0.3);
  17. \node[right]at(0.3,0){$x$};
  18. \node[left]at(0,0.3){$y$};
  19. \draw (0,0) arc (-90:90:1/8) (0,0) arc (-90:90:1/16)
  20. (0,0) arc (180:0:1/8) (0,0) arc (180:0:1/16) (0,0)--(1/8,1/8);
  21. \node [below]at(0.069,0.0627){$A$};
  22. \node [above]at(0.136,0.123){$B$};
  23. \node [right]at(0.105,0.0541){$C$};
  24. \end{tikzpicture}
  25. \end{document}

  1. % 例4-2
  2. \documentclass[10pt]{standalone}
  3. \usepackage{tikz}
  4. \usetikzlibrary{arrows.meta}
  5. \usetikzlibrary{patterns}
  6. \usepackage{unicode-math}
  7. \setmainfont{XITS}
  8. \setmathfont{XITS Math}
  9. \begin{document}
  10. \begin{tikzpicture}[scale=15]
  11. \begin{scope}
  12. \clip (0,0) arc (-90:0:1/8) arc (90:180:1/8);
  13. \fill[pattern=horizontal lines]
  14. (0,0) arc (-90:0:1/8) --(1/16,1/16) arc (90:0:1/16);
  15. \fill[pattern=vertical lines]
  16. (0,0) arc (180:90:1/8) --(1/16,1/16) arc (0:90:1/16);
  17. \end{scope}
  18. \draw [-stealth,thick](-0.05,0)--(0.3,0);
  19. \draw [-stealth,thick](0,-0.05)--(0,0.3);
  20. \node[right]at(0.3,0){$x$};
  21. \node[left]at(0,0.3){$y$};
  22. \draw (0,0) arc (-90:90:1/8) (0,0) arc (-90:90:1/16)
  23. (0,0) arc (180:0:1/8) (0,0) arc (180:0:1/16) (0,0)--(1/8,1/8);
  24. \node [below]at(0.069,0.0627){$A$};
  25. \node [above]at(0.136,0.123){$B$};
  26. \node [right]at(0.105,0.0541){$C$};
  27. \end{tikzpicture}
  28. \end{document}

  1. % 例5
  2. \documentclass{standalone}
  3. \usepackage{tikz}
  4. \usetikzlibrary{arrows.meta}
  5. \usetikzlibrary{patterns}
  6. \usepackage{unicode-math}
  7. \setmainfont{XITS}
  8. \setmathfont{XITS Math}
  9. \begin{document}
  10. \begin{tikzpicture}[scale=1.5]
  11. \begin{scope}
  12. \draw[-stealth] (-0.25,0) -- (3.35,0) node (xaxis) [below] {$x$};
  13. \draw[-stealth] (0,-0.25) -- (0,1.35) node (yaxis) [left] {$y$};
  14. \draw (3,0.025)--(3,-0.025) node[below=-0.5mm] {3};
  15. \draw (0.025,1) -- (-0.025,1) node[left=-0.75mm] {1};
  16. \end{scope}
  17. \draw (-0.15,-0.15) node {$o$};
  18. \draw[fill=gray!30] (2,0) arc [start angle=0, end angle=180, radius=1] -- (3,0) -- (2,1) -- (1,1); %,pattern=dots,even odd rule
  19. \draw[domain=2:3,fill=green!20] plot (\x,3-\x);
  20. \draw[samples=300,domain=0:2.0] plot (\x,{(1-(1-\x)^2)^(1/2)});
  21. \draw[dashed] (0,1) -- (1,1);
  22. \draw[dashed] (2,0) -- (2,1);
  23. \draw[dashed] (1,0) -- (1,1);
  24. \end{tikzpicture}
  25. \end{document}

转载于:https://my.oschina.net/shaodongtang/blog/2252834

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/你好赵伟/article/detail/238215
推荐阅读
相关标签
  

闽ICP备14008679号