I am trying to plot a graph to show the effect of my significant variable on my dependent variable but the data is binary (presence/absence) for both. Could anyone suggest how best to display the data in a graph that is easy for the reader to understand? With a guide of how to do it?

  • 3
    $\begingroup$ Contingency table. Or an equivalent plot. $\endgroup$ Aug 13, 2019 at 11:22

1 Answer 1


The visualisation of categorical data can be challenging and is not as well developed as the visualisation of continuous or mixed categorical/continuous data. So unfortunately, the names of the relevant displays aren't as well known, and this makes searching for help difficult.

In this case, it is likely that you need a mosaic plot (also known as a Marimekko chart), which enables you to plot categorical variables on both the x and y axes (and to have hierarchical levels of each).

Below is a classic example showing survival (light grey) vs non-survival (dark grey) as a function of both sex (male vs female) and class (1st, 2nd, 3rd, or crew) for people on the Titanic. (Taken from the Wikipedia page for mosaic plots.) The left-hand panel shows the actual data, while the right-hand one shows the frequencies that would be expected if the survival outcome was independent of the other variables:

Titanic survival data as a mosaic plot


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.