help for vennbar

Euler or Venn diagrams mapped to bar or dot charts

vennbar
varlist
[weight]
[if exp]
[in range]

[
,
fillin
percent
frformat(str)
pcformat(str)

varlabels
vallabels
separator(str)
recast(subcmd)
graph_options

savedata(filespec)
]

fweights and aweights may be specified.

Description

vennbar produces bar or dot chart alternatives to Euler or Venn
diagrams showing the frequencies (meaning generally, abundances) of
subsets of observations as defined jointly by a bundle of numeric indicator
variables.

The order of variables presented to vennbar does not determine the order in which
they are shown in a plot. By default bars or dotted lines are shown
in order of subset frequency, but choosing a more suitable order is the
user's prerogative. There is considerable scope to change that sort order
using other criteria.

Commonly, but not necessarily, subset frequencies (abundances) are
already in a variable in the dataset. If so, that variable should be
specified as frequency or analytic weights. If no weights are specified,
vennbar counts observations for you. Either way, note that the
focus of this command is on displaying frequencies, and
not the particular values in each subset.

The display by default uses graph hbar but may optionally be
recast as using graph bar (which is not usually advised) or as
using graph dot (which may appeal). The choice is a matter of
personal taste, although in general horizontal displays make it easier
to show and read values or labels of subsets.

The reduced dataset used by vennbar may be saved for future work
using the savedata() option. This dataset may be as useful as or
more useful than the plot. Saving results allows greater flexibility in
plotting. Tabulation or other reporting is also made easier. Results
often need to be scaled in some way, e.g. by looking at conditional
proportions or percents. (Optionally, percents can be saved too.)

The variables in such a reduced dataset are the original indicator
variables and as follows. The names here may thus not be used as names
for the indicator variables specified.

_binary is a string variable containing a binary code such as
"00", "01", "10" or "11".

_decimal is a numeric variable containing a decimal equivalent
such as 0, 1, 2 or 3.

_text is a string variable containing a description of each subset
using variable names or optionally variable labels or optionally value
labels. The text "<none>" is reported for any subset which would
otherwise have empty text.

_freq is a numeric variable containing the frequency of
occurrence of each subset. If analytic weights were specified, values
may have fractional parts. Otherwise values will be integer counts.

(Optionally) _percent is a numeric variable containing the percent
occurrence of each subset.

_degree is a numeric variable indicating the degree of each subset
(number of participating sets), counted as true (1) according to each
indicator variable.

_set is a string variable that indicates each set using its
variable name or optionally its variable label.

_setfreq is a numeric variable that indicates the frequency of each
set.

_set and _setfreq are physically but not logically aligned
with the other variables mentioned above.

Allenby and Slomson (2011, p.14) comment: "There is, unfortunately, no
standard notation for the number of elements in a set". They could have
added "and no standard term either". Terms encountered (other than
"number of elements") include cardinality, order, potency, power, and
the homely size. See annotations of several references.

More detailed Remarks, including many further references, follow later in
this help.

Options

What to show

fillin insists on showing subsets that do not occur with their
frequency This can be helpful if there are only a few
such subsets, but not usually otherwise.

percent specifies listing and plotting of percents rather than
frequencies.

frformat() specifies a display format for frequencies in listings.
This option may be appropriate if any frequencies include fractional
parts. If you wish to specify a format to blabel(),
you should do so directly: see blabel_option.

pcformat() specifies a display format for percents in listings.
The default is %2.1f. This option has no effect without
percent. If you wish to specify a format to blabel(),
you should do so directly: see blabel_option.

Detail of display

varlabels specifies use of variable labels to describe each
subset. The default is to use variable names. In either case, only
variables taking on value 1 in each subset are named or labelled. If a
variable label has not been defined, the variable name is used instead.

vallabels specifies use of value labels to describe each subset. If
value labels are not defined, values 0 or 1 will be used instead. With this
option, subsets defined by values 0 or 1 will always be labelled somehow. This
option may be useful when 0 and 1 represent values that are both of direct
interest, such as alive and dead, wet and dry, or female and male.

separator() specifies a string to separate variable names or, as
above, variable or value labels in display of subsets. The default is ", ",
a comma followed by a space. Hint: the intersection symbol can be
obtained using SMCL's "{&cap}" or Unicode character
(U+2229) through uchar(2229). The SMCL notation will be
interpreted on graphs, but will appear uninterpreted in data listings.
The Unicode character should be interpreted in both.

recast() specifies a subcommand of graph, either bar
or dot, as an alternative to the default hbar. Note: This
option name is inspired by the recast() option of twoway,
but is not that option. If you wish to use twoway instead, specify
the savedata() option and fire up twoway directly on the
results dataset.

graph_options refer to other options of
graph hbar, graph bar or graph dot. As the plot
here has table flavour, some of the ideas covered by Cox (2008) and Cox
(2012) may be helpful. Note that graph may not be especially smart
about any space needed above the highest bar label, so you may need
two passes and a call to yscale() to extend the axis.

The default is over(_text, sort(_freq) descending) blabel(bar). Otherwise
options may refer to variables included in the
reduced dataset as defined above, which could be any of the following:

_binary
_decimal
_text
_freq
_percent (if specified)
_degree

Note that any other over() option overrides this default. Thus if
you want that default and other choices too, you must spell out all your
choices.

Using one or more over() options is often the key to a successful
plot. If these options are unfamiliar to you, do study the examples and
check out graph hbar for its syntax, its suboptions and the linked
nofill option.

Saving results as new dataset

savedata() specifies a (filepath and) filename for saving results to
a new dataset. The specification may include , replace -
which is needed to replace any existing dataset with the same path and
name.

Examples

. local bcolour bar(1, fcolor(blue*0.3) lcolor(blue))

. set more off

. set scheme s1color

. * EXAMPLE 1

. * Schnable et al. 2009 counts of gene families

. clear

. input Rice Maize Sorghum Arabidopsis freq

1 0 0 0 1110

1 1 0 0 229

0 1 0 0 465

1 0 1 0 661

1 1 1 0 2077

0 1 1 0 405

0 0 1 0 265

1 0 1 1 304

1 1 1 1 8494

0 1 1 1 112

0 0 1 1 34

1 0 0 1 81

1 1 0 1 96

0 1 0 1 11

0 0 0 1 1058

end

. label var Arabidopsis "Arabidopsis"

. local toptitle "t1title(Number of gene families)"

. tempfile schnable

. vennbar Arabidopsis Rice Maize Sorghum [fw=freq], `bcolour' `toptitle' varlabels ysc(alt) ysc(r(. 9200)) savedata("`schnable'", replace) name(VB1, replace)

. vennbar Arabidopsis Rice Maize Sorghum [fw=freq], `bcolour' `toptitle' varlabels over(_text, sort(_decimal) descending) over(_degree) nofill ysc(alt) ysc(r(. 9200)) name(VB2, replace)

. vennbar Arabidopsis Rice Maize Sorghum [fw=freq], `toptitle' varlabels sep("; ") marker(1, mcolor(blue)) ysc(r(0 10000)) recast(dot) linetype(line) lines(lc(gs8) lw(thin)) name(VB3, replace)

. vennbar Arabidopsis Rice Maize Sorghum [fw=freq], over(_degree, descending) over(_text, sort(_freq) descending) nofill `bcolour' `toptitle' ysc(alt) name(VB4, replace)

. vennbar Arabidopsis Rice Maize Sorghum [fw=freq], over(_text, sort(_freq) descending) over(_degree, descending) nofill `bcolour' `toptitle' ysc(alt range(. 9200)) name(VB5, replace)

. use "`schnable'", clear

. graph hbar (asis) _setfreq, over(_set, sort(1)) bar(1, lcolor(blue) fcolor(blue*0.3)) blabel(bar) ysc(off) `toptitle' name(VB6, replace)

. su _freq, meanonly

. local N = r(sum)

. * null model, with observed probabilities of being A R M S

. gen double _expected = `N'

. quietly {

. foreach v in Arabidopsis Rice Maize Sorghum {

. * the mean of an indicator is a probability

. su `v' [fw=_freq], meanonly

. replace _expected = _expected * cond(`v' == 1, r(mean), 1 - r(mean))

. }

. * adjust for data not including any 0 0 0 0

. su _expected, meanonly

. replace _expected = `N' * _expected / r(sum)

. }

. * Pearson residuals for null model

. gen _Pearson = (_freq - _expected) / sqrt(_expected)

. graph hbar (asis) _Pearson, over(_text, sort(decimal)) `bcolour' ysc(alt) ytitle(Pearson residuals from null model) name(VB7, replace)

. * EXAMPLE 2

. * incidence of missing values in nlswork.dta

. webuse nlswork, clear

. * missings from Stata Journal: search dm0085, entry

. capture noisily missings report

. foreach v in ind_code union wks_ue tenure wks_work {

. gen M`v' = missing(`v')

. label var M`v' "`v'"

. }

. local toptitle "t1title(Number of missing values)"

. vennbar M*, `toptitle' `bcolour' varlabels name(VB8, replace)

. vennbar M* if missing(ind_code, union, wks_ue, tenure, wks_work), `toptitle' `bcolour' varlabels over(_text, sort(_freq) descending) over(_degree) nofill ysc(r(. 9200)) name(VB9, replace)

. * EXAMPLE 3

. * various indicators in nlswork.dta

. webuse nlswork, clear

. local bcolour bar(1, fcolor(blue*0.3) lcolor(blue))

. local toptitle "t1title(Number of people)"

. vennbar nev_mar c_city collgrad south, `toptitle' `bcolour' name(VB10, replace)

. label var nev_mar "never married"

. label var c_city "central city"

. label var collgrad "college graduate"

. label var south "South"

. vennbar nev_mar c_city collgrad south , `toptitle' `bcolour' varlabels name(VB11, replace)

. vennbar nev_mar c_city collgrad south, varlabels sep("; ") `toptitle' `bcolour' name(VB12, replace)

. label def nev_mar 0 ever 1 never

. label def c_city 0 "non-central" 1 central

. label def collgrad 0 "non-graduate" 1 graduate

. label def south 0 elsewhere 1 South

. foreach v in nev_mar c_city collgrad south {

. label val `v' `v'

. }

. vennbar nev_mar c_city collgrad south, vallabels sep("; ") `toptitle' `bcolour' name(VB13, replace)

Authors

Nicholas J. Cox, Durham University

n.j.cox@durham.ac.uk

Tim P. Morris, MRC Clinical Trials Unit, University College London

tim.morris@ucl.ac.uk

Also see

Help for

misstable

sortmean (if installed)

groups (Stata Journal) (if installed)

upsetplot (if installed)

jaccard (if installed)

findname (Stata Journal) (if installed)

vorter (if installed)

Remarks

Explanation and advice

vennbar requires a bundle of numeric variables with values 0 or 1.
Such variables are variously called indicator, dummy, binary,
dichotomous, zero-one, one-hot, Boolean, logical or quantal. Missing values will
be ignored. Otherwise presenting values other than 0 or 1 is considered
an error. Observations used will thus have all values 0 or 1 in all
variables specified. Differently put, vennbar is not for string
variables or categorical variables that have 3 or more distinct values.

If your dataset is already aggregated to frequencies or other measures
of abundance, specify those as weights multiplying the indicator
variables.

Consider two such indicators. The concatenations 00, 01, 10 and 11
define the 4 possible subsets defined by those variables, and also
distinct binary codes for binary numbers 00 to 11, and also distinct
decimal equivalents 0 to 3. Otherwise put, concatenation is here a
simple and natural way to define composite categorical variables (Cox
2007). 00 is of degree 0, 01 and 10 are of degree 1, and 11 is of degree
2. Here, and indeed generally, leading zeros are retained as helpful
reminders even though they might be considered redundant or ornamental.

Similarly, three such variables have eight possible binary
concatenations 000, 001, 010, 011, 100, 101, 110, 111 and decimal
equivalents 0 to 7. More generally, k such variables define
2^k possible subsets.

Pre-processing

The order of variables presented determines the order in which they are
shown in the key. Choosing a suitable order is considered to be the user's
responsibility. For example, if the data were medical symptoms exhibited
by patients, a substantive grouping (say, cardiovascular symptoms all
together) could make analytical sense. Otherwise, ordering variables by
their means (equivalently, the frequency or abundance of states coded as
1) may be helpful. A utility sortmean is distributed as ancillary
with this package. See also vorter from SSC.

Variables that are identically 0 or identically 1, at least in the data being shown,
are not always useful and so might be omitted. findname (Cox
2010, and search findname, sj for updates) can be used to find
such variables through options all(@ == 0) or all(@ == 1).
Such calls can be extended to check for missing values, which this
command will ignore any way.

Various egen functions can be useful in selecting observations
of particular interest. Thus rowtotal() yielding totals of 2 or
more would identify occurrence of two or more conditions simultaneously.

Historical remarks and literature survey

The elementary but fundamental idea of representing true (or present) as
1 and false (or absent) as 0 has a splendid history. Although it has
yet longer roots, the idea was strongly developed by George Boole
(1815-1864): Boole (1854) was his major work in this territory, on
which see particularly Grattan-Guinness (2005). Boole has been given a
full-length biography (MacHale 2014) and an even longer sequel (MacHale
and Cohen 2018). For shorter accounts see Gardner (1969), Broadbent (1970), MacHale
(2000, 2008), Heath and Seneta (2001), or Grattan-Guinness (2004). See
(e.g.) Dewdney (1993) or Gregg (1998) for samples of how such Boolean
algebra features in computing. See Knuth (1998, Ch.4.1) for an excellent
historical summary of positional number systems and Knuth (2011) for a masterly
synopsis, including historical material, of related combinatorial algorithms.
See Strickland and Lewis (2022) for a focus on binary arithmetic and logic in
the work of Gottfried Wilhelm Leibniz (1646-1716). The leading biography of
Leibniz is by Antognazza (2009), although the earlier biography by Aiton (1985)
is still very helpful. Leibniz's projects feature in many sub-plots in
Stephenson (2003) and its sequels. Cox (2016) makes further Stata-related
comments on truth, falsity, and indication. Cox and Schechter (2019) survey the
creation of indicator variables in Stata.

Various commentators, from Leibniz onward, have seen anticipations
of binary arithmetic in the divination manual I Ching (Yijing, Yi Jing,
Yi King, etc.). That seems exaggerated. See Gardner (1974} for a brisk
discussion and Knuth (2011) and Strickland and Lewis (2022) for further comments.

For 2 or 3 variables Euler or Venn diagrams annotated with subset
frequencies (or other information) are relatively easy to draw and
sometimes to understand, but even for 4 or 5 variables they are harder
to draw and even harder to understand. For say k = 5, 2^5 = 32,
which poses a challenge to show data intelligibly. For say k = 10,
2^10 = 1024, which is often far too many subsets to work with
simultaneously. However, the problem will be eased in practice if many
of the possible subsets do not occur, or occur so rarely that they can
be ignored. For modest values of k, bar or dot charts may be a
competitive alternative, which is the idea implemented here.

This vennbar command is in part a reaction to what have been
called UpSetPlots. See Lex (2021), Lex and Gehlenberg (2014), Lex
et al. (2014), Conway et al. (2017), and Ballarini et al.
(2020). Lex (2022) explains
the origin of the name as a play on "set" and because he was "upset" by
Venn diagram alternatives in the literature (e.g. D'Hont et al.
2012). The idea that Venn diagrams are better replaced by bar chart
alternatives is older (e.g. Kosara 2007) and indeed implicit in any
decision to use bar charts when researchers are aware of Venn diagrams.
The assertion "I would argue that Venn diagrams are a great tool for
learning about sets, but useless as a visualization" (Kosara 2007) is
unfortunately supported by many examples in various literatures.

Hamming (1991, pp.16-17) commended Venn diagrams for simple cases yet
continued: "But if you try to go to very many subsets then the problem of
drawibg a diagram which will show clearly what you are doing is often
difficult. Circles are not, of course, necessary but when you are forced to
draw very snake-like regions then the diagram is of little help in
visualizing the situation."

Gleason (1991, p.33) commented that Venn diagrams become unwieldy for
a number of sets "exceeding 4 or 5".

Venn diagrams are widely familiar in mathematics and science and indeed
as a cultural meme echoed in cartoons, T-shirt or mug designs, and much
else. Christianson (2012) mentioned Venn diagrams as one of
100 diagrams that changed the world. Friendly introductions to set
theory featuring Venn diagrams include Stewart (1975) and Gullberg
(1997). Conversely, compare Hamming (1985, p.367): "Set theory has been
taught until the typical student is weary of it, so we will assume that
it is familiar." Beyond their original and continuing use in logic, Venn
diagrams are commonly used in introductions to probability: see (e.g.)
Pitman (1993), Whittle (2000), Dekking et al. (2005), Miller
(2017), or Blitzstein and Hwang (2019). Historically and to the present
set theory is linked to much fundamental work in logic, number theory,
and other parts of mathematics (Bagaria 2008; various chapters in
Grattan-Guinness 1994; Stillwell 2010).

For the history of Venn and related diagrams, see Baron (1969), Gardner
(1982), Edwards (2004), Moktefi and Shin (2012), and Bennett (2015).
Wainer and Friendly (2021,
pp.102-103) flag the use of an area-proportional Venn-like diagram
by Playfair (1801, opp.p.48). Wilkinson (2012) covers some more recent
work on drawing area-proportional plots from a statistical point of
view. Macfarlane (1885, 1890) referred to composite categories laid out
in sequence as the logical spectrum.

Venn (1880a, 1880b, 1880c, 1881, 1894) made explicit that the diagrams
later named after him grew out of earlier work. Indeed, few logicians were
as fully aware of previous contributions. Thus the name
exemplifies Stigler's Law (1980, 1999) that "No scientific discovery is
named after its original discoverer". The injustice is partially
corrected by crediting Euler's earlier work (1768), on which see conveniently
Sandifer (2007) or Bennett (2015). A distinction is often drawn (e.g.
Mollerup 2015, p.166) that Venn diagrams show all possible combinations,
while Euler diagrams only show actual combinations. However, Euler's
contribution in turn was preceded by yet earlier work by Leibniz and
several other scholars. Nevertheless, crediting Euler or Venn is fair
and there is no point to suggesting yet another term when both terms are
so well established.

John Venn (1834-1923) now benefits from a full-length biography
(Verburgt 2022). For shorter appreciations, see Broadbent (1976),
Grattan-Guinness (2001), or Gibbins (2004). Grattan-Guinness (2011)
places the work of Boole and Venn in context, surveying the development
of logic in 19th century Britain. Venn's interest in probability and
statistics was profound: see especially his first book The Logic of Chance
(1866, 1876, 1888) and a still useful review paper on averages (Venn 1891).

Leonhard Euler (1707-1783) is also well served by a full-length
biography (Calinger 2016). See also Calinger, Denisova and Polyakhova
(2019) on what in English is known as Letters to a German Princess.
For a concise overview of some of his mathematical
achievements, see Dunham (1999). For a shorter although still detailed
account, see Youschkevitch (1971). For a very concise account, see
Sandifer (2008).

For implementations of Venn diagrams in Stata, see (e.g.) Lauritsen (1999a,
1999b, 1999c, 2000, 2009), Gong and Ostermann (2011), and Over (2022).

References

Aiton, E.J. 1985.
Leibniz: A Biography.
Bristol: Adam Hilger.

Allenby, R.B.J.T. and A. Slomson. 2011.
How to Count: An Introduction to Combinatorics.
Boca Raton, FL: CRC Press.

Antognazza, M.R. 2009.
Leibniz: An Intellectual Biography.
New York: Cambridge University Press.

Bagaria, J. 2008.
Set theory.
In Gowers, T. (ed.)
The Princeton Companion to Mathematics.
Princeton, NJ: Princeton University Press, 615-634.

Ballarini, N.M., Y-D. Chiu, F. König, M. Posch, and T. Jaki.
2020.
A critical review of graphics for subgroup analyses in clinical trials.
Pharmaceutical Statistics 19: 541-560.
https://doi.org/10.1002/pst.2012

Baron, M.E. 1969.
A note on the historical development of logic diagrams: Leibniz, Euler
and Venn.
The Mathematical Gazette
53: 113-125. doi:10.2307/3614533

Bennett, D. 2015.
Origins of the Venn diagram.
In Zack, M. and E. Landry (eds)
Research in History and Philosophy of Mathematics.
New York: Springer, 105-120.
https://logic-teaching.github.io/pred/texts/Bennett%202015%20-%20Origins%20of%20the%20Venn%20Diagram.pdf

Biggs, N.L. 2002.
Discrete Mathematics.
Oxford: Oxford University Press.
p.48 size, cardinality

Blitzstein, J.K. and J. Hwang. 2019.
Introduction to Probability.
Boca Raton, FL: CRC Press.

Boole, G. 1854.
An Investigation of the Laws of Thought on Which are Founded the Mathematical Theories of Logic and Probabilities.
London: Walton and Maberley; Cambridge: Macmillan.

Broadbent, T.A.A. 1970.
Boole, George.
In Gillispie, C.C. (ed.} Dictionary of Scientific Biography.
New York: Charles Scribner's Sons 2: 293-298.

Broadbent, T.A.A. 1976.
Venn, John.
In Gillispie, C.C. (ed.} Dictionary of Scientific Biography.
New York: Charles Scribner's Sons 13: 611-613.

Calinger, R.S. 2016.
Leonhard Euler: Mathematical Genius in the Enlightenment.
Princeton, NJ: Princeton University Press.

Calinger, R.S., E. Denisova and E.N. Polyakhova. 2019.
Leonhard Euler's Letters to a German Princess: A Milestone in the History of Physics Textbooks and More.
San Rafael, CA: Morgan & Claypool.

Cameron, P.J. 1994.
Combinatorics: Topics, Techniques, Algorithms.
Cambridge: Cambridge University Press.
p.16 cardinality

Christianson, S. 2012.
100 Diagrams That Changed the World: From the Earliest Cave Paintings to the Innovation of the iPod.
New York: Penguin.

Conway, J.R., A. Lex and N. Gehlenborg. 2017.
UpSetR: An R package for the
visualization of intersecting sets and their properties.
Bioinformatics 33: 2938-2940. doi:10.1093/bioinformatics/btx364.

Cox, N.J. 2007.
Stata tip 52: Generating composite categorical variables.
Stata Journal 7: 582-583.

Cox, N.J. 2008.
Between tables and graphs.
Stata Journal 8: 269-289.

Cox, N.J. 2010.
Speaking Stata: Finding variables.
Stata Journal 10: 281-296.

Cox, N.J. 2012.
Axis practice, or what goes where on a graph.
Stata Journal 12: 549-561.

Cox, N.J. 2016.
Truth, falsity, indication, and negation.
Stata Journal 16: 229-236.

Cox, N.J. 2017.
Tables as lists: The groups command.
Stata Journal 17: 760-773.

Cox, N.J. 2018.
Software update: Tables as lists: The groups command.
Stata Journal 18: 291.

Cox, N.J. and C.B. Schechter. 2019.
How best to generate indicator or dummy variables.
Stata Journal 19: 246-259.

Crossley, J.N., J. Ash, C.J. Brickhill, J.C. Stillwell and N.H.
Williams. 1972.
What is Mathematical Logic?
London: Oxford University Press.
p.69 cardinality

Dekking, F.M., C. Kraikamp, H.P. Lopuhaä and L.E. Meester. 2005.
A Modern Introduction to Probability and Statistics.
London: Springer.

Dewdney, A.K. 1993.
The New Turing Omnibus: 66 Excursions in Computer Science.
New York: Henry Holt.

D'Hont, A. and many authors. 2012.
The banana (Musa acuminata) genome and the evolution of monocotyledonous plants.
Nature 488: 213-217. https://doi.org/10.1038/nature11241

Dunham, W. 1999.
Euler: The Master of Us All.
Washington, DC: Mathematical Association of America.

Edwards, A.W.F. 2004.
Cogwheels of the Mind: The Story of Venn Diagrams.
Baltimore: Johns Hopkins University Press.

Euler, L. 1768.
Lettres à Une Princesse d'Allemagne sur Divers Sujets de Physique & de Philosophie. Tome second.
Saint Petersbourg: L'Académie Impériale des Sciences.

Friendly, M. and H. Wainer. 2021.
A History of Data Visualization and Graphic Communication.
Cambridge, MA: Harvard University Press.

Gardner, M. 1969.
Boolean algebra, Venn diagrams and the propositional calculus.
Scientific American 220(2): 110-114.
https://www.jstor.org/stable/pdf/24926287.pdf
Reprinted as Boolean algebra in 1979.
Mathematical Circus. New York: Alfred A. Knopf, 87-101.

Gardner, M. 1974.
The combinatorial basis of the "I Ching," the Chinese book of divination and wisdom.
Scientific American 230(1): 108-113.
https://www.jstor.org/stable/pdf/24949988.pdf
Reprinted as The I Ching in
1986. Knotted Doughnuts and other Mathematical Entertainments.
New York: W.H. Freeman, 243-256.

Gardner, M. 1982.
Logic Machines and Diagrams.
Chicago: University of Chicago Press.

Gibbins, J.R. 2004.
Venn, John.
In Matthew, H.C.G. and B. Harrison (eds)
Oxford Dictionary of National Biography.
Oxford: Oxford University Press 56: 259-260.

Gleason, A.M. 1991.
Fundamentals of Abstract Analysis.
Bostnn, MA: Jones and Bartlett.
[original publication: 1966. Reading, MA: Addison-Wesley.]

Gong, W. and J. Ostermann. 2011.
pvenn: module to create proportional Venn diagram.
http://fmwww.bc.edu/RePEc/bocode/p
[accessed 20 September 2022]

Graham, R.L., D.E. Knuth and O. Patashnik. 1994.
Concrete Mathematics: A Foundation for Computer Science.
Reading, MA: Addison-Wesley.
p.xi cardinality

Grattan-Guinness, I. (ed.) 1994.
Companion Encyclopedia of the History and Philosophy of the Mathematical Sciences.
London: Routledge.

Grattan-Guinness, I. 2001.
John Venn.
In Heyde, C.C. and E. Seneta (eds)
Statisticians of the Centuries.
New York: Springer, 194-196.

Grattan-Guinness, I. 2004.
Boole, George.
In Matthew, H.C.G. and B. Harrison (eds)
Oxford Dictionary of National Biography.
Oxford: Oxford University Press 6: 582-585.

Grattan-Guinness, I. 2005.
George Boole,
An Investigation of the Laws of Thought on Which are Founded the Mathematical Theories of Logic and Probabilities (1854).
In Grattan-Guinness, I. (ed.)
Landmark Writings in Western Mathematics 1640-1940.
Amsterdam: Elsevier, 470-479.

Grattan-Guinness, I. 2011.
Victorian logic: From Whately to Russell.
In Flood, R., A. Rice and R. Wilson (eds)
Mathematics in Victorian Britain.
Oxford: Oxford University Press, 359-374.

Green, J.A. 1965.
Sets and Groups.
London: Routledge and Kegan Paul.
p.2 order [of a finite set]

Green, J.A. 1988.
Sets and Groups: A First Course in Algebra.
London: Chapman & Hall.
p.2 order [of a finite set]

Gregg, J.R. 1998.
Ones and Zeros: Understanding Boolean Algebra, Digital Circuits, and the Logic of Sets.
Piscataway, NJ: IEEE Press.

Grimmett, G.R. and D.R. Stirzaker. 2020.
Probability and Random Processes.
Oxford: Oxford University Press.
p.6 cardinality

Gullberg, J. 1997.
Mathematics: From the Birth of Numbers.
New York: W.W. Norton.

Hamming, R.W. 1985.
Methods of Mathematics Applied to Calculus, Probability, and Statistics.
Englewood Cliffs, NJ: Prentice-Hall.

Hamming, R.W. 1991.
The Art of Probability for Scientists and Engineers.
Reading, MA: Addison-Wesley.

Heath, P. and E. Seneta. 2001.
George Boole.
In Heyde, C.C. and E. Seneta (eds)
Statisticians of the Centuries.
New York: Springer, 167-170.

Ito, K. (ed.) 1987.
Encyclopedic Dictionary of Mathematics.
Cambridge, MA: MIT Press. [macron accent on o of Ito]
potency, power

James, G. and R.C. James. 1992.
Mathematics Dictionary.
New York: Van Nostrand Reinhold.
potency, power

Knuth, D.E. 1997.
The Art of Computer Programming: Volume 1: Fundamental Algorithms.
Reading, MA: Addison-Wesley.
p.625 cardinality

Knuth, D.E. 1998.
The Art of Computer Programming: Volume 2: Seminumerical Algorithms.
Reading, MA: Addison-Wesley.

Knuth, D.E. 2011.
The Art of Computer Programming: Volume 4A: Combinatorial Algorithms, Part 1.
Upper Saddle River, NJ: Addison-Wesley.

Kosara, R. 2007.
Autism diagnosis accuracy - Visualization redesign.
https://eagereyes.org/criticism/autism-diagnosis-accuracy
[accessed 20 September 2022]

Lauritsen, J.M. 1999a.
Drawing Venn diagrams.
Stata Technical Bulletin 47: 3-8.

Lauritsen, J.M. 1999b.
Drawing Venn diagrams.
Stata Technical Bulletin 48: 3.

Lauritsen, J.M. 1999c.
Drawing Venn diagrams.
Stata Technical Bulletin 49: 8.

Lauritsen, J.M. 2000.
An update to drawing Venn diagrams.
Stata Technical Bulletin 54: 17-19.

Lauritsen, J.M. 2009.
venndiag: module to generate Venn diagrams.
http://fmwww.bc.edu/RePEc/bocode/v
[accessed 20 September 2022]

Lex, A. 2021. UpSet: Visualizing intersecting sets.
https://upset.app/
[accessed 20 September 2022]

Lex, A. 13 September 2022.
https://mobile.twitter.com/alexander_lex/status/1569741352417787905
[accessed 20 September 2022]

Lex, A. and N. Gehlenborg. 2014.
Sets and intersections.
Nature Methods 11: 779. doi:10.1038/nmeth.3033

Lex, A., N. Gehlenborg, H. Strobelt, R. Vuillemot and H. Pfister. 2014.
UpSet: Visualization of intersecting sets.
IEEE Transactions on Visualization and Computer Graphics 20:
1983-1992. doi:10.1109/TVCG.2014.2346248/

Liebeck, M. 2016.
A Concise Introduction to Pure Mathematics.
Boca Raton, FL: CRC Press.
p.195 cardinality

Macfarlane, A. 1885.
The logical spectrum.
The London, Edinburgh, and Dublin Philosophical Magazine and Journal of Science
Series 5, 19 (119): 286-290.
doi:10.1080/14786448008626877.

Macfarlane, A. 1890.
Adaption of the method of the logical spectrum to Boole's problem.
Proceedings of the American Association of the Advancement of Science
39: 57-60.

MacHale, D. 2000.
George Boole 1815-1864.
In Houston, K. (ed.)
Creators of Mathematics: The Irish Connection.
Dublin: University College Dublin Press, 27-32.

MacHale, D. 2008.
George Boole.
In Gowers, T. (ed.)
The Princeton Companion to Mathematics.
Princeton, NJ: Princeton University Press, 769-770.

MacHale, D. 2014.
The Life and Work of George Boole: A Prelude to the Digital Age.
Cork: Cork University Press.

MacHale, D. and Y. Cohen. 2018.
New Light on George Boole.
Cork: Cork University Press.

Miller, S.J. 2017.
The Probability Lifesaver: All the Tools You Need to Understand Chance.
Princeton, NJ: Princeton University Press.

Moktefi, A. and S.-J. Shin. 2012.
A history of logic diagrams.
In Gabbay, D.M., F.J. Pelletier and J. Woods (eds)
Handbook of the History of Logic. Volume 11: Logic: A History of Its Central Concepts.
Amsterdam: North-Holland, 611-682.

Mollerup, P.
2015.
Data Design: Visualizing Quantities, Locations, Connections.
London: Bloomsbury.

Over, M. 2022.
pvenn2: Proportional Venn diagram, enhanced version of pvenn.
http://digital.cgdev.org/doc/stata/MO/Misc
[accessed 20 September 2022]

Pitman, J. 1993.
Probability.
New York: Springer.

Playfair, W. 1801.
The Statistical Breviary.
London: Wallis etc.

Sandifer, C.E. 2007.
How Euler Did It.
Washington, DC: Mathematical Association of America.

Sandifer, C.E. 2008.
Leonhard Euler.
In Gowers, T. (ed.)
The Princeton Companion to Mathematics.
Princeton, NJ: Princeton University Press, 747-749.

Schnable, P.S. and many co-authors. 2009.
The B73 maize genome: complexity, diversity, and dynamics.
Science 326: 1112-1115.
http://www.jstor.org/stable/27736489

Stephenson, N. 2003.
Quicksilver: Volume One of the Baroque Cycle.
New York: William Morrow.

Stewart, I. 1975.
Concepts of Modern Mathematics.
Harmondsworth: Penguin.

Stigler, S.M. 1980.
Stigler's law of eponymy.
Transactions of the New York Academy of Sciences
39: 147-158. doi:10.1111/j.2164-0947.1980.tb02775.x

Stigler, S.M. 1999.
Statistics on the Table: The History of Statistical Concepts and Methods.
Cambridge, MA: Harvard University Press.

Stillwell, J. 2010.
Mathematics and Its History.
New York: Springer.

Strickland, L. and H.R. Lewis. 2022.
Leibniz on Binary: The Invention of Computer Arithmetic.
Cambridge, MA: MIT Press.

Venn, J. 1866, 1876, 1888.
The Logic of Chance.
London: Macmillan.

Venn, J. 1880a.
On the forms of logical proposition.
Mind 5(19): 336-349.

Venn, J. 1880b.
On the diagrammatic and mechanical representation of propositions and reasonings.
The London, Edinburgh, and Dublin Philosophical Magazine and Journal of Science
Series 5, 10 (59): 1-18.
doi:10.1080/14786448008626877.

Venn, J. 1880c.
On the employment of geometrical diagrams for the sensible
representation of logical propositions.
Transactions of the Cambridge Philosophical Society
4: 47-59.

Venn, J. 1881, 1894.
Symbolic Logic.
London: Macmillan.

Venn, J. 1891.
On the nature and uses of averages.
Journal of the Royal Statistical Society
52: 429-456.

Verburgt, L.M. 2022.
John Venn: A Life in Logic.
Chicago: University of Chicago Press.

Whittle, P. 2000.
Probability via Expectation.
New York: Springer.

Wilkinson, L. 2012.
Exact and approximate area-proportional circular Venn and Euler
diagrams.
IEEE Transactions on Visualization and Computer Graphics
18: 321-331. doi:10.1109/TVCG.2011.56

Youschkevitch, A.P. 1971.
Euler, Leonhard.
In Gillispie, C.C. (ed.} Dictionary of Scientific Biography.
New York: Charles Scribner's Sons 4: 467-484.

Zeitz, P. 2007.
The Art and Craft of Problem Solving.
Hoboken, NJ: John Wiley.
p.147 cardinality

Bibliographic note on Martin Gardner's columns

Martin Gardner's columns on "Mathematical Games" over many years in
Scientific American covered much more than games and puzzles and
included many splendid expositions of topics with mathematical content.
They present a variety of small bibliographical challenges. The original
articles will be accessible to many readers at jstor.org, but typically
under the titles "Mathematical Games". A further tiny detail is that
pagination starts afresh in each issue of Scientific American, so
volume and issue number together are needed for an exact citation. The
columns were collected later in book form, often revised and/or
retitled, in books that themselves often varied in publisher and even
title over various reprints and reissues. A project to publish further
revised editions, under yet other titles, from Cambridge University
Press and the Mathematical Association of America, released its first
four volumes between 2008 and 2014, but appears to have stalled. At the
time of writing it had not reached the books mentioned here.

https://en.wikipedia.org/wiki/List_of_Martin_Gardner_Mathematical_Games_columns
and
https://ansible.uk/misc/mgardner.html
will help you find what you are looking for or indeed to determine
whether a relevant column was ever written.