画出特定部分

画出特定部分

我怎样才能将特定部分涂成白色?

这里是代码:

\documentclass[headsepline,BCOR=10mm,11pt,twoside,openright,cleardoublepage=empty,bibliography=totoc,numbers=noenddot]{scrbook}
    \usepackage[activate={true,nocompatibility},final,tracking=true,kerning=true,spacing=true,factor=1100,stretch=10,shrink=10]{microtype}
    \usepackage[paperwidth=17cm,paperheight=24cm,top=2.5cm,bottom=2.5cm,inner=2.0cm,outer=1.5cm]{geometry} 
    \usepackage{lipsum}
    \usepackage[
      scale=1,
      angle=0,
      opacity=1,
      contents={}
    ]{background}
    \usetikzlibrary{calc}
    \usepackage[numbers,comma,square,sort&compress]{natbib}
    \usepackage[format=plain,singlelinecheck=false,font={footnotesize,sl},labelfont=bf]{caption}
    \begin{document}
    \begin{figure}
    \centering
    \begin{tikzpicture}
    %\newcommand*{\OutAngle}{60}
     % \newcommand*{\ArcMax}{1.2}

        \fill[fill=blue!20]
        (0,0) node {}
     -- (2,2) node[] {}
     -- (2,0) node {};  
         \fill[fill=yellow!20]
        (0,0) node {}
     -- (2,2) node[] {}
     -- (0,2) node {};  
          \fill[fill=blue!20]
        (2,2) node {}
     -- (4,3.01) node[] {}
     -- (4,2) node {};  
           \fill[fill=yellow!20]
        (2,2) node {}
     -- (3,4) node[] {}
     -- (2,4) node {};  
         \fill[fill=blue!20]
        (2, 0) rectangle (4, 2);
             \fill[fill=yellow!20]
        (0, 2) rectangle (2, 4);
        \draw[dashed]
        (-0.2,2)-- (2,2)
        (2,0)-- (2,2);
            \draw
        (0, 0) rectangle (4, 4)
        (0,0) -- (2.3,2.3) ; 
            \draw
        (0, 0) rectangle (4, 4)
        (0,0) -- (2.3,2.3) ; 
            \draw[dashed]
        (-0.2,2)-- (2,2) 
        (2,0)-- (2,2);
         \draw[->]
         (2,2) -- (2,4.2);
         \draw[->]
        (2,2) -- (4.2,2);
       \draw[] (4.2,1.8) node {\tiny $ \epsilon_{\tiny A}$}  
        (1.8,4.2) node {\tiny $\epsilon_{\tiny B}$};  
        \node (c) at (3,1) { \tiny prova };
        \node (b) at (1,3) { \tiny prova };
        \node[]at (1,1){\tiny Antagonistic };
        \node[]at (1,0.7){\tiny Sector };
        \node[rotate=45]at (3,3){\tiny prova };


    \draw[fill=blue!20] (2,2) to[out=30,in=180] (4,3);
    \draw[fill=yellow!20] (2,2) to[out=60,in=270] (3,4);

    \end{tikzpicture}
    \caption{capt}
      \label{dise}
    \end{figure}
    \end{document}

在此处输入图片描述

答案1

在这种情况下,这很容易。你已经有了所有的路径,所以你可以说

\draw[fill=red!20] (2,2) to[out=30,in=180] (4,3) |- (3,4)
 to[out=270,in=60] (2,2);

如您所见,您只需要在反向路径中交换in和的角色即可。out

    \documentclass[headsepline,BCOR=10mm,11pt,twoside,openright,cleardoublepage=empty,bibliography=totoc,numbers=noenddot]{scrbook}
    \usepackage[activate={true,nocompatibility},final,tracking=true,kerning=true,spacing=true,factor=1100,stretch=10,shrink=10]{microtype}
    \usepackage[paperwidth=17cm,paperheight=24cm,top=2.5cm,bottom=2.5cm,inner=2.0cm,outer=1.5cm]{geometry} 
    \usepackage{lipsum}
    \usepackage[
      scale=1,
      angle=0,
      opacity=1,
      contents={}
    ]{background}
    \usetikzlibrary{calc}
    \usepackage[numbers,comma,square,sort&compress]{natbib}
    \usepackage[format=plain,singlelinecheck=false,font={footnotesize,sl},labelfont=bf]{caption}
    \begin{document}
    \begin{figure}
    \centering
    \begin{tikzpicture}[font=\tiny]
    %\newcommand*{\OutAngle}{60}
     % \newcommand*{\ArcMax}{1.2}

        \fill[fill=blue!20]
        (0,0) node {}
     -- (2,2) node[] {}
     -- (2,0) node {};  
         \fill[fill=yellow!20]
        (0,0) node {}
     -- (2,2) node[] {}
     -- (0,2) node {};  
          \fill[fill=blue!20]
        (2,2) node {}
     -- (4,3.01) node[] {}
     -- (4,2) node {};  
           \fill[fill=yellow!20]
        (2,2) node {}
     -- (3,4) node[] {}
     -- (2,4) node {};  
         \fill[fill=blue!20]
        (2, 0) rectangle (4, 2);
             \fill[fill=yellow!20]
        (0, 2) rectangle (2, 4);
        \draw[dashed]  (-0.2,2)-- (2,2)   (2,0)-- (2,2);
            \draw
        (0, 0) rectangle (4, 4)
        (0,0) -- (2.3,2.3) ; 
            \draw
        (0, 0) rectangle (4, 4)
        (0,0) -- (2.3,2.3) ; 
            \draw[dashed]
        (-0.2,2)-- (2,2) 
        (2,0)-- (2,2);
         \draw[->]
         (2,2) -- (2,4.2);
         \draw[->]
        (2,2) -- (4.2,2);
        \draw[fill=red!20] (2,2) to[out=30,in=180] (4,3) |- (3,4)
            to[out=270,in=60] (2,2);

        \draw[] (4.2,1.8) node {$\scriptscriptstyle  \epsilon_{A}$}  
        (1.8,4.2) node {$\scriptscriptstyle\epsilon_{B}$};  
        \node (c) at (3,1) { prova };
        \node (b) at (1,3) { prova };
        \node[]at (1,1){Antagonistic };
        \node[]at (1,0.7){Sector };
        \node[rotate=45]at (3,3){prova };


    \draw[fill=blue!20] (2,2) to[out=30,in=180] (4,3);
    \draw[fill=yellow!20] (2,2) to[out=60,in=270] (3,4);

    \end{tikzpicture}
\caption{capt}
  \label{dise}
\end{figure}
\end{document}

在此处输入图片描述

答案2

只需用所需颜色填充矩形

\fill[orange] (0,0) rectangle (4,4);

在其他fill命令之前draw

在此处输入图片描述

我已修改了代码,使其变得最少。

\documentclass{scrbook}
\usepackage{tikz}
\begin{document}
\begin{figure}
    \centering
    \begin{tikzpicture}
    \draw[fill=orange] (0,0) rectangle (4,4);
    \draw[fill=blue!20] (0,0) -- (2,2) to[out=30,in=180] (4,3) -- (4,0);
    \draw[fill=yellow!20] (0,0) -- (2,2) to[out=60,in=270] (3,4) --(0,4);

    \draw[dashed] (-0.2,2)-- (2,2)
        (2,0)-- (2,2);
    \draw  (0,0) -- (2.3,2.3) ; 
    \draw[->] (2,2) -- (2,4.2);
    \draw[->] (2,2) -- (4.2,2);

    \draw[] (4.2,1.8) node {\tiny $ \epsilon_{\tiny A}$}  
        (1.8,4.2) node {\tiny $\epsilon_{\tiny B}$};  
    \node (c) at (3,1) { \tiny prova };
    \node (b) at (1,3) { \tiny prova };
    \node[]at (1,1){\tiny Antagonistic };
    \node[]at (1,0.7){\tiny Sector };
    \node[rotate=45]at (3,3){\tiny prova };
    \end{tikzpicture}
    \caption{capt}
      \label{dise}
\end{figure}
\end{document}

相关内容