3

I need to produce something similar to this with latex enter image description here

I am not familiar at all with the tikz package. However I was able to find a code that I think could be adapted to fit with my needs:

\begin{tikzpicture}[scale=0.75][thick]
   \draw (0,0) circle (2cm);
   \draw (3,-1) circle (2.5cm);
   \draw (0,0) node {A};
   \draw (3.2,-1) node {B};
   \draw [clip](0,0) circle (2cm);
   \fill[yellow] (3,-1) circle (2.5cm);
\end{tikzpicture}

It produces this figure: enter image description here

Does anybody have an idea of how I could adapt the above code to get what I want?

Thanks for your help.

2
  • The source code was found at latex-community.org/forum/viewtopic.php?f=45&t=9937
    – JaneDoe
    May 31 '16 at 11:38
  • Welcome to TeX.SX!! It is better to post a full minimal working example. It's better to include the full code in he question rather than posting a link. A LaTeX MWE should start with a \documentclass command, have a minimal preamble and then \begin{document}...\end{document}. The code should compile and be as small as possible to demonstrate your problem. This makes it much easier for people to help you --- and much more likely that they will!
    – user30471
    May 31 '16 at 12:15
4

No need to clip; you can use fill opacity. Start with:

\documentclass[margin=10pt]{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[
    thick]
    \draw [fill=cyan, fill opacity=0.5] (0,0) circle (2cm);
    \draw [fill=orange, fill opacity=0.5] (3,-1) circle (2.5cm);
\end{tikzpicture}
\end{document}

composing opacities

and the rest of the thing is a bit of geometry and maybe the intersections library:

\documentclass[margin=10pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows,positioning,calc,intersections}
\begin{document}
\begin{tikzpicture}[
    thick]
    \draw [fill=cyan, fill opacity=0.5, name path=c1] (0,0) circle (2cm);
    \draw [fill=orange, fill opacity=0.5, name path=c2] (3,-1) circle (2.5cm);
    \draw (0,0) ++(120:2cm) -- ++(120:2.2cm) node [fill=white,inner sep=5pt](a){a};
    \draw (3, -1) ++(30:2.5cm) -- ++(30:2.6cm) node [fill=white,inner sep=5pt](b){b};
    \path [name intersections={of=c1 and c2,by=cs}];
    \draw (cs) -- ++(.5,1) node [fill=white,inner sep=5pt](c){c};
\end{tikzpicture}
\end{document}

with labels

...I leave the rectangles in the legend as an exercise.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.