Draw Circle on Map and Intersections
What is a Venn Diagram?
Venn diagram, known besides equally set up diagram, was invented by John Venn around 1880. It consists of overlapping circles or other shapes to illustrate the logical relationships between two or more sets of things.
Before starting with Venn Diagrams, Permit's acquire how to draw circles and add together labels in LaTeX using TikZ package.
How to depict a circle in TikZ?
Drawing a circle in LaTeX using TikZ can be washed using 1 of the post-obit methods:
- Method 1: using \draw control and circle functioning as follows:
\draw (ten,y) circumvolve(r);
The in a higher place line lawmaking draws a circle at the center with coordinates (x,y) and radius r.
- Method two: using node control with draw, circle and minimum size=<value> options:
\node[draw,circle,minimum size=2cm] (proper name) at (x,y){CircleContent}; The advantage of this method is that we can access the circle borders coordinates, add label and describe other circles using relative positioning. I deeply invite you to cheque this post TikZ shapes: Circle
How to add label to a node in TikZ?
Adding a characterization to a node can be accomplished using label=<text> option with node command. Here is an example of a red circumvolve with A label:
\documentclass[edge=0.2cm]{standalone} % Required package \usepackage{tikz} \begin{document} \brainstorm{tikzpicture} % Circle with label \node[draw, circle, minimum size =2cm, fill up=scarlet!50, label=$A$] (circle1) at (0,0){}; \end{tikzpicture} \finish{document}
The label is positioned at the pinnacle of the circumvolve. To change it, we can specify of the characterization angle with respect to the horizontal line passing through the node centre. Here is an example of two circles with unlike positioning labels:
\documentclass[border=0.2cm]{standalone} % Required package \usepackage{tikz} \brainstorm{document} \begin{tikzpicture} % Circle with label at 225 deg. \node[draw, circle, minimum size =2cm, fill=cyan!50, label={225:$A$}] (circle1) at (0,0){}; % Circle with label at 45 deg. \node[describe, circle, minimum size =2cm, fill=yellow!50, characterization={45:$B$}] (circle2) at (3,0){}; \end{tikzpicture} \end{document} The side by side changes the label distance as well as the font colour and size:
\documentclass[border=0.2cm]{standalone} % Required package \usepackage{tikz} \begin{certificate} \begin{tikzpicture} % Circumvolve with characterization distance 0.5cm \node[draw, circle, minimum size =2cm, fill=violet!fifty, label={[label distance=0.5cm,red]225:$A$}] (circle1) at (0,0){}; % Circumvolve with large label font \node[draw, circle, minimum size =2cm, fill=cyan!50, label={[label distance=0.25cm,font=\big]45:$B$}] (circle2) at (3,0){}; \stop{tikzpicture} \terminate{certificate}
Simple Venn diagram
The next LaTeX lawmaking highlights the intersection of ii sets A and B and adds a text node at the one-half distance between the two nodes centers:
\documentclass[border=0.2cm]{standalone} % Required package \usepackage{tikz} \brainstorm{certificate} \begin{tikzpicture} % Set A \node [draw, circumvolve, minimum size =3cm, characterization={135:$A$}] (A) at (0,0){}; % Prepare B \node [draw, circumvolve, minimum size =3cm, label={45:$B$}] (B) at (1.8,0){}; % Prepare intersection label \node at (0.ix,0) {$A\cap B$}; \end{tikzpicture} \cease{document}
LaTeX Venn diagram: Spousal relationship of ii sets
The adjacent LaTeX lawmaking draws two circles filled with orange color. The circumvolve on the top will hide the border of the bottom circumvolve. For that, the border of the two sets' circles have to be drawn separately with respect to the filled circles. Here is an illustrative example with thick white borders:
\documentclass[border=0.2cm]{standalone} % Required packet \usepackage{tikz} \begin{document} \begin{tikzpicture} % Set A \node [circle, fill=orange, minimum size =3cm, characterization={135:$A$}] (A) at (0,0){}; % Ready B \node [circumvolve, fill=orange, minimum size =3cm, label={45:$B$}] (B) at (1.8,0){}; % Circles outline \draw[white,thick] (0,0) circle(i.5cm); \draw[white,thick] (1.8,0) circle(1.5cm); % Union text label \node[orange!90!black] at (0.9,i.viii) {$A\cup B$}; \stop{tikzpicture} \terminate{document} Compiling the code yields:
Simplify the lawmaking with style option
The previous LaTeX code can exist simplified by regrouping different options using style command. This corresponds to the options: circle , fill=orange, minimum size=3cm . The style is named ready in the adjacent code:
\documentclass[border=0.2cm]{standalone} % Required package \usepackage[dvipsnames]{xcolor} \usepackage{tikz} \begin{document} \begin{tikzpicture}[thick, set/.style = {circle, fill=orange, minimum size =3cm }] % Set A \node [set, label={135:$A$}] (A) at (0,0){}; % Set B \node [fix, characterization={45:$B$}] (B) at (1.8,0){}; % Circles outline \describe[white] (0,0) circle(1.5cm); \describe[white] (1.8,0) circle(1.5cm); % Union text label \node[orange!90!black] at (0.9,1.8) {$A\cup B$}; \terminate{tikzpicture} \end{document}
LaTeX Venn diagram: Difference of two sets
The next illustration shows the LaTeX Venn diagram of the difference of Two sets A and B. The question at present is how to highlight the difference result?
The deviation tin can be easily highlighted by: 1) filling the A set up with the green color, two) filling the B gear up with white color and 3) describe borders and add A-B label. These iii steps are shown in the next illustration:
Here is the corresponding LaTeX code of the Venn diagram of the difference of two sets (A-B):
\documentclass[border=0.2cm]{standalone} % Required package \usepackage[dvipsnames]{xcolor} \usepackage{tikz} \brainstorm{certificate} \begin{tikzpicture}[thick, set up/.style = { circle, minimum size = 3cm}] % Fix A \node[set up,fill=OliveGreen,label={135:$A$}] (A) at (0,0) {}; % Set B \node[set,fill=white,label={45:$B$}] (B) at (0:2) {}; % Circles outline \draw (0,0) circumvolve(1.5cm); \draw (2,0) circle(ane.5cm); % Difference text label \node[left,white] at (A.center){$A-B$}; \stop{tikzpicture} \finish{certificate} With the same way as A-B we tin can highlight the difference B-A:
\documentclass[border=0.2cm]{standalone} % Required package \usepackage[dvipsnames]{xcolor} \usepackage{tikz} \brainstorm{document} \brainstorm{tikzpicture}[thick, set/.style = { circle, minimum size = 3cm}] % Set B \node[set,fill=OliveGreen,label={45:$B$}] (B) at (0:2) {}; % Set A \node[set,fill up=white,label={135:$A$}] (A) at (0,0) {}; % Circles outline \draw (0,0) circle(ane.5cm); \describe (ii,0) circle(one.5cm); % Difference text label \node[right,white] at (B.center){$B-A$}; \end{tikzpicture} \end{document}
LaTeX Venn diagram: Intersection of two sets
Let's reconsider the above code of the elementary Venn diagram. The two circles accept to be firstly created and filled with a given color then nosotros make full the intersection region between the two circles. The latter can be achieved by using prune command within a telescopic environment. Hither is an illustrative example:
\documentclass[border=0.2cm]{standalone} % Required packages \usepackage[dvipsnames]{xcolor} \usepackage{tikz} \begin{document} \brainstorm{tikzpicture}[thick, set/.style = {circumvolve, minimum size = 3cm, make full=MidnightBlue!50}] % Set A \node[set,label={135:$A$}] (A) at (0,0) {}; % Set B \node[set,label={45:$B$}] (B) at (1.viii,0) {}; % Intersection \begin{telescopic} \clip (0,0) circle(1.5cm); \prune (1.8,0) circle(1.5cm); \fill[Dandelion](0,0) circumvolve(ane.5cm); \stop{telescopic} % Circles outline \describe (0,0) circumvolve(1.5cm); \describe (one.8,0) circle(1.5cm); % Set intersection label \node at (0.9,0) {$A\cap B$}; \end{tikzpicture} \end{certificate} Nosotros used \clip command inside a scope environment to get a local effect of the clipping. All drawings within the scope environment volition be clipped to the airtight path created past \clip control. Nosotros used \clip twice to consider only the intersection region between the two circles.
For more practice, Permit's consider the example of three sets!
LaTeX Venn diagram: Intersection of 3 sets
We take three circles with labels A, B and C. Circles are filled with greyness colour and the intersection region betwixt them is filled with orangish color which tin can be achieved past using the clip command in one case for each circumvolve. Check the code below!
\documentclass[edge=0.2cm]{standalone} % Required packages \usepackage[dvipsnames]{xcolor} \usepackage{tikz} \begin{certificate} \brainstorm{tikzpicture}[thick, set/.style = {circumvolve, minimum size = 3cm, fill=blackness!30}] % Prepare A \node[set,label={135:$A$}] (A) at (0,0) {}; % Set B \node[set,label={45:$B$}] (B) at (1.8,0) {}; % Fix C \node[set,label=$C$] (C) at (0.9,1.5) {}; % Intersection \begin{scope} \clip (0,0) circumvolve(ane.5cm); \clip (1.eight,0) circle(ane.5cm); \clip (0.9,1.five) circle(i.5cm); \fill[orangish!60](0,0) circumvolve(ane.5cm); \finish{scope} % Circles outline \describe (0,0) circle(1.5cm); \draw (1.8,0) circle(one.5cm); \draw (0.9,1.five) circle(ane.5cm); \end{tikzpicture} \stop{certificate}
Barycentric coordinate organisation in TikZ
To become the coordinate of the triangle circumcenter formed by the centers of the three circles, we can utilise the barycentric coordinate system provided by TikZ as follows:
\node at (barycentric cs:A=one,B=i ,C=i) {$D$}; Adding the above line code to the previous TikZ code, we get the following result:
LaTeX Venn diagram: transparency effect
With the same fashion, nosotros create a styling for the circles representing our sets: they accept a radius of 6 cm, and they accept a transparent filling, which enables intersections to have beautiful, mixed colors. We use opaque text to arrive easier to read.
Nosotros ready the center distance at four cm to take plenty space for the intersections. We get-go positioned set A, then placed set B at an angle of lx degrees with respect to A, and fix C next to A.
To add labels to different regions, we used barycentric part which calculates the weighted average of our sets' coordinates. If we apply the same weight for all the sets, it will produce the midpoint, which we can use for writing into intersection surface area.
Hither is the corresponding LaTeX lawmaking:
\documentclass[border=0.2cm]{standalone} % Required packages \usepackage[dvipsnames]{xcolor} \usepackage{tikz} \begin{document} \begin{tikzpicture} [set/.style = {draw, circle, minimum size = 6cm, fill=Rhodamine, opacity = 0.4, text opacity = 1}] \node (A) [set up] {$A$}; \node (B) at (60:4cm) [gear up] {$B$}; \node (C) at (0:4cm) [set] {$C$}; \node at (barycentric cs:A=1,B=1) [left] {$X$}; \node at (barycentric cs:A=1,C=1) [below] {$Y$}; \node at (barycentric cs:B=ane,C=one) [right] {$Z$}; \node at (barycentric cs:A=1,B=ane,C=i) [] {$T$}; \end{tikzpicture} \finish{document}
LaTeX Venn diagram Iv ellipses
It corresponds to iv ellipses with unlike rotations and shifting. Drawing an ellipse in LaTeX can be done using draw command and ellipse performance equally follows:
\describe (x,y) ellipse (Xr and Twelvemonth);
where Xr and Yr are ten-radius and y-radius of the ellipse. Hither is an instance of Four Ellipses Venn Diagram in LaTeX:
and the corresponding code:
\documentclass[border=0.2cm]{standalone} % Required packages \usepackage{tikz} \begin{document} \brainstorm{tikzpicture}[set/.manner={fill=cyan,make full opacity=0.one}] % Help grid \draw[blackness!five,footstep=0.5] (-3,-3) grid (3,three); \foreach \i in {-3,-ii,...,3} { \node[beneath] at (\i,-3){\minor \i}; \node[left] at (-three,\i){\small \i}; } % Ellipse one \draw[ready, rotate =45] (0,0) ellipse (2cm and 1cm); % Ellipse 2 \depict[set, rotate =-45] (0,0) ellipse (2cm and 1cm); % Ellipse three \describe[set, xshift=1cm, yshift=-0.705cm, rotate =45] (0,0) ellipse (2cm and 1cm); % Ellipse four \describe[prepare, xshift=-1cm, yshift=-0.705cm, rotate =-45,] (0,0) ellipse (2cm and 1cm); \cease{tikzpicture} \end{document} hollowayhenter1962.blogspot.com
Source: https://latexdraw.com/how-to-draw-venn-diagrams-in-latex/
0 Response to "Draw Circle on Map and Intersections"
Post a Comment