You can add some options to the original code using draw
and fill
parameters for the circles and the rectangle. Modifying the code on the fly can be done using the xpatch
package, similar to Venn diagram outlines.
Then you can set the commands used in those parameters to values that correspond to the diagram that you want to draw. Using draw=none
and an empty label a circle can be removed from the diagram, and fill=white
makes a circle visible if the rectangle is filled with fill=lightgray
. To resume drawing 'normal' diagrams you need to reset the macros to the default values.
Note that #6 does not need any modifications, this can be done by setting the provided key overlap
to a negative value.
MWE:
\documentclass{article}
\usepackage{venndiagram}
\usepackage{xpatch}
\def\framefill{none}
\def\afill{none}
\def\bfill{none}
\def\adraw{black}
\def\bdraw{black}
\makeatletter
% patch drawing of A and B
\xpatchcmd{\endvenndiagram2sets}
{%
\draw (\@venn@Ax,\@venn@Ay) circle (\@venn@radius);
\draw (\@venn@Bx,\@venn@By) circle (\@venn@radius);
}
{
\draw [draw=\adraw, fill=\afill] (\@venn@Ax,\@venn@Ay) circle (\@venn@radius);
\draw [draw=\bdraw, fill=\bfill] (\@venn@Bx,\@venn@By) circle (\@venn@radius);
}
{\typeout{patch ok}}{\typeout{patch failed}}
% patch frame
\xpatchcmd{\endvenndiagram2sets}
{\draw (venn bottom left) rectangle (\@venn@w,\@venn@h);}
{\draw [fill=\framefill] (venn bottom left) rectangle (\@venn@w,\@venn@h);}
{\typeout{patch ok}}{\typeout{patch failed}}
\makeatother
\begin{document}
\begin{venndiagram2sets}
\fillA \fillB
\end{venndiagram2sets}
\begin{venndiagram2sets}
\fillACapB
\end{venndiagram2sets}
\begin{venndiagram2sets}[overlap=-0.75cm]
\fillA \fillB
\end{venndiagram2sets}
\def\bdraw{none}
\begin{venndiagram2sets}[labelB={}]
\fillA
\end{venndiagram2sets}
\def\framefill{lightgray}
\def\afill{white}
\begin{venndiagram2sets}[labelB={$A^c$}]
\end{venndiagram2sets}
\def\afill{none}
\def\adraw{none}
\begin{venndiagram2sets}[labelA={},labelB={}]
\end{venndiagram2sets}
\end{document}
Result:

venndiagram
package instead of using onlytikz
, so I voted for reopening.