Martin Krzywinski / Genome Sciences Center / mkweb.bcgsc.ca Martin Krzywinski / Genome Sciences Center / mkweb.bcgsc.ca - contact me Martin Krzywinski / Genome Sciences Center / mkweb.bcgsc.ca on Twitter Martin Krzywinski / Genome Sciences Center / mkweb.bcgsc.ca - Lumondo Photography Martin Krzywinski / Genome Sciences Center / mkweb.bcgsc.ca - Pi Art Martin Krzywinski / Genome Sciences Center / mkweb.bcgsc.ca - Hilbertonians - Creatures on the Hilbert Curve
Tango is a sad thought that is danced.Enrique Santos Discépolothink & dance

Bioinformatics and Genome Analysis Course. Izmir International Biomedicine and Genome Institute, Izmir, Turkey. May 2–14, 2016


visualization + design

Christopher Hitchens—Out of Letters

ASCII Art

The images shown here were created as part of my ASCII Art project, which extends ASCII art to include

  • proportionally spaced fonts
  • a variety of font weights in a single image
  • both tone and structure of the image to select characters
  • fixed strings to render an image in legible text

Applying the code to images of Hitchens was motivated by my own deep love of Hitchens and a typographic portrait of Christopher Hitchens, created out of Gill Sans letters by Miles Chic at Capilano University.

This adds to my growing shrines to Hitchens, including Merry Hitchmas! and hitchslap t-shirts.

Christopher Hitchens in Letters and Words

All images are generated using Gotham, with up to 8 weights (Extra Light to Ultra). Each image includes size and characters used for the image. I give the absolute type size, though only useful to know in relative terms to the size of the image and other images drawn with the same method. The color of text in each layer is the same—black— but font weight may vary.

Some images are generated using more than one layer of ASCII. In some cases the characters used in each layer are different.

basic ascii

As the font size is reduced, greater detail and contrast can be achieved.

Christopher Hitchens - ASCII Art / Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
Christopher Hitchens ASCII Art. method: Gotham font, 8 weights, 43pt set: . x 8 : * @ - \ | _space_ / (source from Christian Witkin/Twelve/Grand Central Publishing) (zoom, source)
Christopher Hitchens - ASCII Art / Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
Christopher Hitchens ASCII Art. method: Gotham font, 8 weights, 29pt set: . x 8 : * @ - \ | _space_ / (source from Christian Witkin/Twelve/Grand Central Publishing) (zoom, source)
Christopher Hitchens - ASCII Art / Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
Christopher Hitchens ASCII Art. method: Gotham font, 8 weights, 17pt set: . x 8 : * @ - \ | _space_ / (source from Christian Witkin/Twelve/Grand Central Publishing) (zoom, source)
Christopher Hitchens - ASCII Art / Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
Christopher Hitchens ASCII Art. method: Gotham font, 8 weights, 11pt set: . x 8 : * @ - \ | _space_ / (source from Christian Witkin/Twelve/Grand Central Publishing) (zoom, source)

By setting the image with a fixed string, such as a short quote or longer body of text, detail is lost but the ASCII representation takes on more meaning.

Christopher Hitchens - ASCII Art / Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
Christopher Hitchens ASCII Art. method: Gotham font, 8 weights, 11pt set: godisnotgreat (source from Christian Witkin/Twelve/Grand Central Publishing) (zoom, source)
Christopher Hitchens - ASCII Art / Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
Christopher Hitchens ASCII Art. method: Gotham font, 8 weights, 29pt set: godisnotgreat (source from Christian Witkin/Twelve/Grand Central Publishing) (zoom, source)
Christopher Hitchens - ASCII Art / Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
Christopher Hitchens ASCII Art. method: Gotham font, 8 weights, 11pt set: Hitchslap 11 (source from Christian Witkin/Twelve/Grand Central Publishing) (zoom, source)
Christopher Hitchens - ASCII Art / Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
Christopher Hitchens ASCII Art. method: Gotham font, 8 weights, 5 layers (11pt -6deg, 17pt 6deg, 29pt -3deg, 43pt 3deg, 59pt 0deg) set: godisnotgreat (source from Christian Witkin/Twelve/Grand Central Publishing) (zoom, source)
Christopher Hitchens - ASCII Art / Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
Christopher Hitchens ASCII Art. method: Gotham font, 8 weights, 7pt set: . x 8 : * @ - \ | _space_ / (source from Gasper Tringale) (zoom, source)

multi-layered ascii art

Images take on detail when multiple rotated layers of text is used. Each of the images below is composed of more than one layer, starting with a 2-layer image which uses the uppercase alphabet at 0 and 90 degrees.

Christopher Hitchens - ASCII Art / Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
Christopher Hitchens ASCII Art. method: Gotham font, 8 weights, 2 layers (0deg, 90deg) set: A-Z (source from HBO) (zoom, source)

Meaning can be added to the image by using different text in each layer. In the examples below, I set the same image using the pair "Godisnotgreat" (at 0 degrees) and "religionpoisonseverything" (at 90 degrees). In the second example, I use the unlikely combination of "Jesus" and "Mohammad"—inspired by Jesus and Mo.

Christopher Hitchens - ASCII Art / Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
Christopher Hitchens ASCII Art. method: Gotham font, 8 weights, 2 layers set: Godisnotgreat. 0deg Relionpoisonseverything. 90deg (source from HBO) (zoom, source)
Christopher Hitchens - ASCII Art / Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
Christopher Hitchens ASCII Art. method: Gotham font, 8 weights, 2 layers set: Jesus 0deg Mohammad 90deg (source from HBO) (zoom, source)

When rotated layers contain punctuation, very high level of detail can be achieved.

Christopher Hitchens - ASCII Art / Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
Christopher Hitchens ASCII Art. method: Gotham font, 8 weights, 2 layers set: . : - + * _space_ 0deg / 90deg (zoom, source)

The image below is made out of layers that contain only forward (/) and back (\) slashes.

Christopher Hitchens - ASCII Art / Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
Christopher Hitchens ASCII Art. method: Gotham font, 8 weights, 2 layers set: \ / (zoom, source)

The image below is made using only the period character in three layers rotated at -45, 0 and 45 degrees. Although the image looks like a pixelated version of the original—it is more than that. It is a typeset representation that uses 8 weights of Gotham. Character spacing between periods is informed by font metrics.

Christopher Hitchens - ASCII Art / Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
Christopher Hitchens ASCII Art. method: Gotham font, 8 weights, 2 layers set: . (zoom, source)
Christopher Hitchens - ASCII Art / Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
Christopher Hitchens ASCII Art. method: Gotham font, 8 weights, 2 layers set: 8 X x | ^ : . - = + ' " @ \ / | * ~ , # (source from The Australian) (zoom, source)

hitchens at the podium

The three images below show the difference between using a variety of punctuation characters and setting an image using a block of text. The first image uses "8 X x" and common punctuation.

Christopher Hitchens - ASCII Art / Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
Christopher Hitchens ASCII Art. method: Gotham font, 8 weights, 11pt set: 8 X x | ^ : . - = + ' " @ \ / | * ~ , # (zoom, source)

I use hitchslap 9 for the first image below, and all the hitchslaps for the second image. When setting an image in using a block of text, the choice of character at any position is fixed and only the font weight is allowed to vary. When the text is relatively short (e.g. hitchslap 9 is 544 characters and is repeated 50 times in the image), rivers of space appear in the image.

Christopher Hitchens - ASCII Art / Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
Christopher Hitchens ASCII Art. method: Gotham font, 8 weights, 11pt set: Hitchslap 9 (zoom, source)
Christopher Hitchens - ASCII Art / Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
Christopher Hitchens ASCII Art. method: Gotham font, 8 weights, 11pt set: all Hitchslaps (zoom, source)

In both cases, the image is very recognizable.

recursive ascii art

When an image of text is set with the text itself, you have recursive ASCII art. Below is hitchslap 2, set with itself. In the image, the font is Gotham and the text used to asciify the image is also Gotham.

It makes ordinary moral people, compels them, forces them, in some cases orders them do disgusting wicked unforgivable things. There's no expiation for the generations of misery and suffering that religion has inflicted in this way and continues to inflict. And I still haven't heard enough apology for it. — Christopher Hitchens

The quote is 307 characters long and is repeated 391 times in the image.

Christopher Hitchens - ASCII Art / Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
Christopher Hitchens ASCII Art. method: Gotham font, 8 weights, 11pt set: Hitchslap 2 (source from hitchslap 2) (zoom, source)

In principle, the process of asciifying text with text can be repeated, by using the asciified image as input for asciification with progressively smaller text.

news + thoughts

Gene Volume Control

Thu 11-06-2015

I was commissioned by Scientific American to create an information graphic based on Figure 9 in the landmark Nature Integrative analysis of 111 reference human epigenomes paper.

The original figure details the relationships between more than 100 sequenced epigenomes and genetic traits, including disease like Crohn's and Alzheimer's. These relationships were shown as a heatmap in which the epigenome-trait cell depicted the P value associated with tissue-specific H3K4me1 epigenetic modification in regions of the genome associated with the trait.

Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
Figure 9 from Integrative analysis of 111 reference human epigenomes (Nature (2015) 518 317–330). (details)

As much as I distrust network diagrams, in this case this was the right way to show the data. The network was meticulously laid out by hand to draw attention to the layered groups of diseases of traits.

Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
Network diagram redesign of the heatmap for a select set of traits. Only relationships with –log P > 3.9 are displayed. Appears on Graphic Science page in June 2015 issue of Scientific American. (details)

This was my second information graphic for the Graphic Science page. Last year, I illustrated the extent of differences in the gene sequence of humans, Denisovans, chimps and gorillas.

Sampling distributions and the bootstrap

Thu 11-06-2015

The bootstrap is a computational method that simulates new sample from observed data. These simulated samples can be used to determine how estimates from replicate experiments might be distributed and answer questions about precision and bias.

Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
Nature Methods Points of Significance column: Sampling distributions and the bootstrap. (read)

We discuss both parametric and non-parametric bootstrap. In the former, observed data are fit to a model and then new samples are drawn using the model. In the latter, no model assumption is made and simulated samples are drawn with replacement from the observed data.

Kulesa, A., Krzywinski, M., Blainey, P. & Altman, N (2015) Points of Significance: Sampling distributions and the bootstrap Nature Methods 12:477-478.

Background reading

Krzywinski, M. & Altman, N. (2013) Points of Significance: Importance of being uncertain. Nature Methods 10:809-810.

...more about the Points of Significance column

Bayesian statistics

Thu 30-04-2015

Building on last month's column about Bayes' Theorem, we introduce Bayesian inference and contrast it to frequentist inference.

Given a hypothesis and a model, the frequentist calculates the probability of different data generated by the model, P(data|model). When this probability to obtain the observed data from the model is small (e.g. `alpha` = 0.05), the frequentist rejects the hypothesis.

Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
Nature Methods Points of Significance column: Bayesian Statistics. (read)

In contrast, the Bayesian makes direct probability statements about the model by calculating P(model|data). In other words, given the observed data, the probability that the model is correct. With this approach it is possible to relate the probability of different models to identify one that is most compatible with the data.

The Bayesian approach is actually more intuitive. From the frequentist point of view, the probability used to assess the veracity of a hypothesis, P(data|model), commonly referred to as the P value, does not help us determine the probability that the model is correct. In fact, the P value is commonly misinterpreted as the probability that the hypothesis is right. This is the so-called "prosecutor's fallacy", which confuses the two conditional probabilities P(data|model) for P(model|data). It is the latter quantity that is more directly useful and calculated by the Bayesian.

Puga, J.L, Krzywinski, M. & Altman, N. (2015) Points of Significance: Bayes' Theorem Nature Methods 12:277-278.

Background reading

Puga, J.L, Krzywinski, M. & Altman, N. (2015) Points of Significance: Bayes' Theorem Nature Methods 12:277-278.

...more about the Points of Significance column

Bayes' Theorem

Wed 22-04-2015

In our first column on Bayesian statistics, we introduce conditional probabilities and Bayes' theorem

P(B|A) = P(A|B) × P(B) / P(A)

This relationship between conditional probabilities P(B|A) and P(A|B) is central in Bayesian statistics. We illustrate how Bayes' theorem can be used to quickly calculate useful probabilities that are more difficult to conceptualize within a frequentist framework.

Martin Krzywinski @MKrzywinski mkweb.bcgsc.ca
Nature Methods Points of Significance column: Bayes' Theorem. (read)

Using Bayes' theorem, we can incorporate our beliefs and prior experience about a system and update it when data are collected.

Puga, J.L, Krzywinski, M. & Altman, N. (2015) Points of Significance: Bayes' Theorem Nature Methods 12:277-278.

Background reading

Oldford, R.W. & Cherry, W.H. Picturing probability: the poverty of Venn diagrams, the richness of eikosograms. (University of Waterloo, 2006)

...more about the Points of Significance column