LaTeX:图形的填充(生成阴影图形)

将内网和外网看到的综合整理。

韦恩图Venn

\documentclass{standalone}

\usepackage{tikz}

%导出为图片需要安装imagemagick
%https://tex.stackexchange.com/questions/91472/how-to-save-a-figure-produced-by-tikz-save-export-as-jpg-png-file
%可用acrobat pro转存

\begin{document}
	
%http://blog.sina.com.cn/s/blog_5e16f1770102dzj4.html
%韦恩图venn - 两个圆相交
\begin{tikzpicture}
	\draw (0,0) circle (2cm);
	\draw (2,0) circle (2cm);
	\clip[draw] (0,0) circle (2cm);
	\clip[draw] (2,0) circle (2cm);
	\foreach \x in {-1,-0.75,-0.5,-0.25,0,0,0.25,0.5,0.75,1,1.25,1.5,1.75,2,2.25,2.5,2.75}
	\draw[xshift=\x cm]  (-2,2)--(2,-2);
	\node at (1,0) {$I$};
\end{tikzpicture}

%韦恩图venn - 3个圆相交
\begin{tikzpicture}
	\draw (0,0) circle (2cm);
	\draw (55:2.67cm) circle (2cm);
	\draw (0:3cm) circle (2cm);
	\begin{scope}
		\clip (0,0) circle (2cm);
		\clip (55:2.67cm) circle (2cm);
		\clip (0:3cm) circle (2cm);
		\foreach \x in {-1,-0.75,-0.5,-0.25,0,0,0.25,0.5,0.75,1,1.25,1.5,1.75,2,2.25,2.5,2.75}
		\draw[xshift=\x cm]  (-2,2)--(2,-2);
	\end{scope}
	\node at (1.5,-0.5) {$II$};
\end{tikzpicture}

%韦恩图venn - 3个圆相交(斜线填充)
\begin{tikzpicture}  %用[scale=0.8]出问题!
	\tikzset{venn circle/.style={draw,circle,minimum width=6cm,fill=#1,opacity=0.5,very thick}}
	\node [venn circle = red] (A) at (0,0) {$A$};
	\node [venn circle = blue] (B) at (60:4cm) {$B$};
	\node [venn circle = green] (C) at (0:4cm) {$C$};
	\draw (0,0) circle (3cm);
	\draw (60:4cm) circle (3cm);
	\draw (0:4cm) circle (3cm);
	\begin{scope}
	\clip (0,0) circle (3cm);
	\clip (60:4cm) circle (3cm);
	\foreach \x in {-5,-4.5,-4,-3.5,-3,-2.5,-2,-1.5,-1,-0.5,0,0.5,1,1.5,2,2.5,3,3.5,4,4.5,5}
	\draw[overlay, xshift=\x cm]  (2,4)--(2,0);
	\end{scope}
	\begin{scope}
	\clip (60:4cm) circle (3cm);\clip (0:4cm) circle (3cm);
	\foreach \y in {-5,-4.5,-4,-3.5,-3,-2.5,-2,-1.5,-1,-0.5,0,0.5,1,1.5,2,2.5,3,3.5,4,4.5,5}
	\draw[overlay, xshift=\y cm]  (1,0)--(5,4);
	\end{scope}
	\begin{scope}
	\clip (0,0) circle (3cm);
	\clip (0:4cm) circle (3cm);
	\foreach \z in {-5,-4.5,-4,-3.5,-3,-2.5,-2,-1.5,-1,-0.5,0,0.5,1,1.5,2,2.5,3,3.5,4,4.5,5}
	\draw[overlay, yshift=\z cm]  (0,3)--(4,3);
	\end{scope}
	\node at (2,-0.5) {$III$};
\end{tikzpicture}

\end{document}

 

 

用pattern包填充

\documentclass{standalone}

\usepackage{tikz}
\usetikzlibrary{patterns}  %条纹

%导出为图片需要安装imagemagick
%https://tex.stackexchange.com/questions/91472/how-to-save-a-figure-produced-by-tikz-save-export-as-jpg-png-file
%可用acrobat pro转存

\begin{document}
%https://tex.stackexchange.com/questions/446941/venn-diagrams-and-patterns
\begin{tikzpicture}[red,every node/.style={font=\Large}]
\draw[pattern=north west lines] (0,0) circle(1.5);
\draw (2,0) circle(1.5);
\node[fill=white,inner sep=1pt,rounded corners,below=3] at (90:1.5) {$A$};
\node[xshift=2cm,below=3] at (90:1.5) {$B$};
\end{tikzpicture}

\end{document}

 

\documentclass{standalone}

\usepackage{tikz}
\usetikzlibrary{arrows.meta}
\usetikzlibrary{patterns}  %条纹

%导出为图片需要安装imagemagick
%https://tex.stackexchange.com/questions/91472/how-to-save-a-figure-produced-by-tikz-save-export-as-jpg-png-file
%可用acrobat pro转存

\begin{document}

%http://bbs2.ctex.org/forum.php?mod=viewthread&tid=155195
\begin{tikzpicture}[scale=25]
\begin{scope}
\clip (0,0) arc (-90:0:1/8) arc (90:180:1/8);
\fill[gray,even odd rule] (0,0) arc (-90:0:1/8) arc (90:180:1/8) 
arc (-90:270:1/16) arc (-180:180:1/16) arc (-90:0:1/16) arc (90:180:1/16);
\end{scope}
\draw [->,thick](-0.05,0)--(0.3,0);\draw [->,thick](0,-0.05)--(0,0.3);
\node[right]at(0.3,0){$x$};\node[left]at(0,0.3){$y$};
\draw (0,0) arc (-90:90:1/8) (0,0) arc (-90:90:1/16)
(0,0) arc (180:0:1/8) (0,0) arc (180:0:1/16) (0,0)--(1/8,1/8);
\node [below]at(0.069,0.0627){$A$};
\node [above]at(0.136,0.123){$B$};
\node [right]at(0.105,0.0541){$C$};
\end{tikzpicture} 

\begin{tikzpicture}[scale=25]
\begin{scope}
\clip (0,0) arc (-90:0:1/8) arc (90:180:1/8);
\fill[pattern=horizontal lines]
(0,0) arc (-90:0:1/8) --(1/16,1/16) arc (90:0:1/16);
\fill[pattern=vertical lines]
(0,0) arc (180:90:1/8) --(1/16,1/16) arc (0:90:1/16);
\end{scope}
\draw [->,thick](-0.05,0)--(0.3,0);\draw [->,thick](0,-0.05)--(0,0.3);
\node[right]at(0.3,0){$x$};\node[left]at(0,0.3){$y$};
\draw (0,0) arc (-90:90:1/8) (0,0) arc (-90:90:1/16)
(0,0) arc (180:0:1/8) (0,0) arc (180:0:1/16) (0,0)--(1/8,1/8);
\node [below]at(0.069,0.0627){$A$};
\node [above]at(0.136,0.123){$B$};
\node [right]at(0.105,0.0541){$C$};
\end{tikzpicture}

\end{document}

 

\documentclass{standalone}

\usepackage{tikz}
\usetikzlibrary{arrows.meta}

\begin{document}
%https://my.oschina.net/u/3468093/blog/2252834
\begin{tikzpicture}[smooth]
\draw[arrows={-Stealth[length=5pt, inset=3.5pt]}] (-0.5,0) -- (3.0,0)node (xaxis) [right=-1pt] {$x$};
\draw[arrows={-Stealth[length=5pt, inset=3.5pt]}] (0,-0.5) -- (0,4.5)node (yaxis) [above=-0.6pt] {$y$};
\draw  (-0.18,-0.18) node {$o$};
\draw[color=red,domain=0:2.0,fill=green!20] plot (\x,4*\x-\x*\x);
\draw[color=red!40,domain=0:2.90] plot (\x,4*\x-\x*\x)  ;
\draw[color=blue!30,domain=0:2.3] plot (\x,2*\x)  ;
\draw[fill=black] (2,4) circle [radius=0.2pt] node[above=-1.8pt] {$A(2,4)$};
\end{tikzpicture}  

\end{document}

\documentclass[10pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows.meta}
\begin{document}
%https://my.oschina.net/u/3468093/blog/2252834
	\begin{tikzpicture}[yscale=0.7]
	\draw[-stealth] (-0.4,0)--(2,0) node[below,scale=0.6]{$x$};
	\draw[-stealth] (0,-0.3)--(0,5) node[left,scale=0.6]{$y$};
	\draw (0,0) node [below left,scale=0.6] {$o$};
	\foreach \i in {1}{\draw (\i,0)--node [below,scale=0.6] {$1$}(\i,0.05);}
	\draw (0,1) node [left,scale=0.6] {$1$};
	\draw (1.35,1) node [right,scale=0.6] {$l_x$};
	\draw (0.4,3.85742) node [above,scale=0.6] {$l_y$};
	\draw (1.35,-0.2) -- (1.35,4.25519);
	\draw (-0.2,3.85742) -- (1.55,3.85742);
	\draw (1.35,3.85742) node [below right,scale=0.6] {$M(x,y)$};
	%\clip (-1,-1) rectangle (5,5);%只在这个区域内画图
	\draw[domain=1:4,smooth,variable=\t] plot ({ln(\t)+1/(2*\t)-0.5},\t)node[above,scale=0.6] {$C_3$};
	\draw[domain=0:1.8,smooth] plot (\x,{0.5*1+0.5*exp(\x)}) node[below right,scale=0.6] {$C_1$};
	\draw[domain=0:1.45,smooth] plot (\x,{exp(\x)}) node[below right,scale=0.6] {$C_2$};
	\filldraw [fill=gray!20] (0,0) -- plot [domain=0:1.35,smooth] (\x,{exp(\x)}) -- (1.35,0) -- (0,0);
	\filldraw [fill=white] (0,0) -- plot [domain=0:1.35,smooth] (\x,{0.5*1+0.5*exp(\x)}) -- (1.35,0) -- (0,0);
	\filldraw [fill=gray!40] (0,1) -- plot [domain=0:1.35,smooth] (\x,{exp(\x)}) -- (0,3.85742) -- (0,1);
	\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);
	\end{tikzpicture}
\end{document}

 

 

\documentclass[tikz,border=0pt,10pt]{standalone}
\usetikzlibrary{arrows.meta}
\usetikzlibrary{patterns}
\definecolor{pink}{RGB}{249,164,186}
\definecolor{grassgreen}{RGB}{128,255,0}
\usepackage{scalerel} %\scaleobj{1.5}{} 缩放公式大小
\begin{document}
%https://my.oschina.net/u/3468093/blog/2252834
	\begin{tikzpicture}[scale=1.5]
	\draw[-stealth] (-0.3,0) -- (2.2,0)node (xaxis) [right,scale=0.8] {$x$};
	\draw[-stealth] (0,-1.6) -- (0,1.6)node (yaxis) [left,scale=0.8] {$y$};
	\fill[pink!] (0,0) -- (1,-1) arc [start angle=315, end angle=405, radius=1.414] -- (0,0);
	\fill[pink!] (1,0) -- (1,1) arc [start angle=90, end angle=180, radius=1] -- (0,0);
	\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);
	\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);
	\draw (1,-0.02)--(1,0.02) node[below] {$\scaleobj{0.6}{1}$};
	\draw (1.414,-0.02)--(1.414,0.02) node[below] {$\scaleobj{0.6}{\sqrt{2}}$};
	\draw[style=dashed,color=red,domain=-0.1:1.4] plot(\x,-\x);
	\draw[color=black,domain=-0.1:2.2] plot(\x,0);
	\draw[style=dashed] (0,0)--(0,-1.414) arc [start angle=270, end angle=450, radius=1.414];
	\draw (1,0) circle [radius=1];
	%\fill[pattern=north west lines](0,0)--(-2,0)--(-2,2)--(0,2)arc(90:270:0.8); 
	%\fill[pattern=north west lines]arc(-45:0:1); 
	\end{tikzpicture}
\end{document}

 

 

 

posted @ 2018-11-13 17:39  hzworld  阅读(4061)  评论(0编辑  收藏  举报