[Tex/LaTex] How to label sets in Venn diagram using venndiagram package

labels

How do I have the labels (A and B) outside the circles? I would like a solution that uses the venndiagram package.

Code:

\documentclass{article}
\usepackage{venndiagram}
\begin{document}
    \begin{venndiagram2sets}[shade=blue,tikzoptions={opacity=0.5}]
        \fillOnlyA
    \end{venndiagram2sets}
\end{document}

Best Answer

Solution 1.:

(Modified after the comment of @CarLaTeX)

\documentclass{article}
\usepackage{venndiagram}
\begin{document}
    \begin{venndiagram2sets}[shade=blue,tikzoptions={opacity=0.5},labelA={},labelB={}]
        \fillOnlyA
\setpostvennhook
        {
            \draw (labelA) node[above=2pt] {A};
            \draw (labelB) node[above=2pt] {B};
            }
    \end{venndiagram2sets}
\end{document}

enter image description here

Solution 2.:

You could use tikzlibrary calc, and with its help, it's easy to put the labels on certain coordinates.

(I used @Jake's answer for TikZ: Node at same x-coordinate as another node, but specified y-coordinate?)

\documentclass{article}
\usepackage{tikz}
\usepackage{venndiagram}
\usetikzlibrary{calc}
\begin{document}
    \begin{venndiagram2sets}[shade=blue,tikzoptions={opacity=0.5},labelA={},labelB={}]
        \fillOnlyA
\setpostvennhook
        {
            \path let \p1 = (labelA) in node at (\x1,3.2) {A};
            \path let \p2 = (labelB) in node at (\x2,0.2) {B};
            }
   \end{venndiagram2sets}
\end{document}

enter image description here