1

I'm wondering how I should use \fillbetween as the following:

enter image description here

I need to change the color of "Weakly solvable" and "Unsolvable" areas.

\documentclass[border=2pt]{standalone}

\usepackage[dvipsnames]{xcolor}
\usepackage{tikz}
\usepackage{amsmath}
\usepackage{pgfplots}
\pgfplotsset{compat=1.11}
\usepgfplotslibrary{fillbetween}
\usetikzlibrary{intersections}
\usetikzlibrary{automata,positioning,shapes}
\begin{document}

    \begin{tikzpicture}
    \node at (2,4) {\textbf{Weakly solvabale}};
    \draw[name path = line] (4,5) -- (4,0);
    \draw [rounded corners=15pt] (0,0) rectangle ++(7,5);
    \draw[name path = circle, fill=LimeGreen] (2,1.7) circle [radius=1.2cm] node {\textbf{Solvable}};
    \node at (5.5,2.5) {\textbf{Unsolvabale}};
    of=line and circle,
    soft clip={domain=-3:3}
    ];
    \begin{pgfonlayer}{bg}
    \fill [orange!50,
    intersection segments={
        of=circle and line
    }];
    \end{pgfonlayer}
    \end{tikzpicture}

\end{document}  
2
  • Are you looking for something like this, but with the rectangle split horizontal option added?
    – Emma
    Nov 17, 2017 at 5:23
  • MWE doesn't compile...the bg layer is not defined
    – user30471
    Nov 17, 2017 at 6:52

1 Answer 1

3

First we use an horizontal splitted node with left part top aligned. After that we draw a circular node inside the left part. That's all.

\documentclass[border=2pt, tikz, dvipsnames]{standalone}
\usetikzlibrary{positioning,shapes.multipart}
\begin{document}

    \begin{tikzpicture}

    \node[rectangle split,
            rectangle split horizontal,
            rectangle split parts=2,
            rectangle split part fill={green!30, red!30},
            rectangle split part align={top, center},
            rounded corners,
            draw,
            minimum height=4cm,
            text width=3cm,
            text centered,
            inner ysep=3mm,
            font = \bfseries] (box) {Weakly solvabable \nodepart{two} Unsolvable};

    \node[above=5mm of box.one south, circle, fill=LimeGreen, font=\bfseries, draw] {Solvable}; 

    \end{tikzpicture}   
\end{document}  

enter image description here

Another solution with a bicolor tcolorbox:

\documentclass[border=2pt, tikz, dvipsnames]{standalone}
\usepackage[most]{tcolorbox}
\usetikzlibrary{positioning}
\begin{document}
    \begin{tcolorbox}[
        enhanced,
        bicolor,
        sidebyside,
        halign upper=center,
        halign lower=center,
        fontupper=\bfseries,
        fontlower=\bfseries,
        colframe=black,
        notitle,
        colback=LimeGreen!30,
        colbacklower=OliveGreen!50,
        width=7cm,]
        Weakly Solvable \\
        \begin{tcolorbox}[boxsep=0pt, 
            colback=LimeGreen, 
            colframe=black, 
            halign=center, 
            valign=center, 
            square, circular arc]
                Solvable
        \end{tcolorbox}
        \tcblower
        Unsolvable
   \end{tcolorbox}  
\end{document}  

enter image description here

1
  • 1
    You are great! +1 for your answer.
    – Sebastiano
    Nov 17, 2017 at 11:10

You must log in to answer this question.