Graph to display differences (or lack of) in multilevel categorical data

I am trying to find an interesting way to interpret and display a set of data for the research I'm working on. Columns 2-4 show the net change from time 1 to time 2 in antibiotic coverage for different types of bacteria (types A-D). 1 means coverage for that type of bacteria was added, and -1 means coverage for that bacteria was stopped, and 0 means there was no change in coverage (i.e. it wasn't covered at time 1 or at time 2, or it was covered the same at both times). Column 1 shows whether bacterial cultures were positive or negative. I'm interested in showing graphically the differences in coverage for A-D when cultures are positive vs. negative. Each row represents a different case.

You'll notice that there is no change (0) in A-D in the majority of cases. The fact that most cases had no change may be the most interesting point, but I'm not sure how to make that point stand out on a graph either.

The graph's i've tried making have only included the cases in which there is at least 1 change. So far I've tried mostly mostly bar/column graphs showing the proportion of positive/negative cultures with each changes. So the column might be B - Add with a culture-positive and culture-negative bar showing the relative proportions of each to see if the culture made a difference in adding B, and the same for B - Stop, C - Add, C - Stop, etc, for each category.

For the most part I've seen that the culture doesn't really impact whether coverage for each category was added or stopped, but the charts I'm making don't tell that in a convincing way.

Any thoughts?

Culture     A   B   C   D
negative    0   0   0   0
positive    -1  0   0   0
positive    0   0   0   0
negative    1   1   1   0
negative    0   -1  -1  0
negative    0   0   -1  0
negative    0   0   0   0
negative    0   0   0   0
positive    0   0   0   0
negative    0   0   0   0
negative    0   0   0   0
negative    0   -1  0   0
negative    0   0   0   0
positive    1   0   0   1
positive    0   0   0   0
positive    0   -1  -1  0
negative    1   1   1   0
negative    0   0   0   0
negative    0   0   0   0
negative    0   0   0   0
negative    0   0   0   0
negative    0   -1  0   0
negative    0   1   0   0
negative    0   0   0   0
negative    0   0   0   0
negative    0   0   0   0
negative    0   0   0   0
negative    0   0   0   0
positive    0   0   0   0
positive    0   1   -1  0
positive    0   0   1   0
negative    0   0   0   0
negative    1   1   1   0
positive    0   0   0   0
positive    1   1   1   0
negative    -1  -1  -1  0
negative    0   0   0   0
negative    0   0   0   0
negative    -1  -1  -1  0
positive    0   0   0   0
negative    0   0   0   0
positive    1   0   0   0
negative    0   -1  0   0
negative    0   0   0   0
positive    0   0   0   0
negative    -1  -1  0   0
negative    0   0   0   0
negative    0   0   -1  0
negative    0   0   1   0
positive    0   0   0   0
negative    0   0   0   0
positive    0   0   -1  0
negative    0   0   0   0
negative    0   0   0   0
positive    1   0   0   0
negative    0   0   0   0
negative    0   0   -1  0
negative    0   0   0   -1
negative    0   0   0   0
negative    0   0   0   0
negative    0   0   0   0
negative    0   0   0   0
negative    0   0   0   0
negative    0   0   0   0
negative    0   0   -1  0
negative    0   -1  -1  0
positive    -1  0   0   0
negative    0   0   0   0
negative    0   0   0   0
positive    0   0   0   0
negative    0   0   0   0
negative    1   1   1   0
positive    0   0   0   0
negative    0   0   0   0
negative    -1  0   0   0
positive    0   1   0   0
negative    0   0   0   0
positive    -1  -1  0   0
positive    -1  0   0   0
positive    0   0   0   1
positive    0   0   0   0
negative    0   0   0   0
positive    0   -1  0   0
positive    -1  -1  -1  0
negative    0   0   -1  0
negative    0   0   0   0
negative    0   -1  -1  0
negative    0   1   0   0
negative    0   0   0   0
positive    0   0   0   0
negative    -1  -1  -1  0
negative    0   0   0   0
negative    0   0   0   0
negative    0   0   0   0
negative    0   0   0   0
negative    1   1   1   0
positive    0   0   0   0
positive    0   0   0   0
negative    0   0   0   0
negative    0   0   0   0
positive    0   0   0   0
negative    0   1   0   0
negative    -1  1   0   0
negative    0   0   0   0
positive    1   1   1   0
negative    0   0   0   1
negative    0   0   0   0
negative    0   0   0   0
negative    1   0   0   0
negative    -1  0   0   0
negative    -1  0   0   0
negative    0   0   0   0
positive    -1  0   0   0
positive    0   0   0   0
negative    0   -1  0   1
negative    -1  -1  0   0
negative    -1  0   0   0
negative    0   0   0   0
negative    -1  0   0   0
negative    -1  0   0   0
negative    0   0   0   0
negative    0   0   0   0
negative    0   0   0   0
negative    0   0   0   0
negative    1   1   1   0
negative    0   0   0   0
negative    -1  0   0   0
positive    0   0   0   0
negative    0   0   0   0
negative    0   0   0   1
negative    0   0   0   0
negative    0   0   1   0
positive    0   0   0   0
negative    0   0   0   0
negative    0   0   -1  0
negative    0   0   0   0
negative    -1  0   0   0
negative    0   0   0   0
negative    0   0   0   0
positive    0   0   0   1
positive    -1  0   0   0
positive    -1  -1  -1  0
positive    1   0   1   0
negative    -1  0   0   0
positive    0   1   0   0
negative    0   0   0   0
positive    0   0   0   0
negative    0   0   0   0
negative    1   1   1   1
negative    0   0   0   0
negative    0   0   0   0
negative    0   0   0   0
negative    1   1   0   0
negative    0   0   0   0
negative    -1  -1  -1  0
negative    0   -1  0   0
negative    1   0   0   0
positive    0   0   0   0
negative    1   1   0   0
negative    0   0   0   0
positive    0   0   0   0
negative    -1  0   0   0
negative    -1  0   0   0
negative    1   1   1   0
negative    0   -1  0   0
positive    0   0   -1  0
negative    0   0   0   0
positive    1   0   0   0
negative    0   0   0   0
positive    0   1   1   0
positive    0   0   0   0
negative    -1  -1  -1  0
negative    1   1   1   0
negative    1   1   1   0
negative    0   0   0   0
negative    0   0   1   0
positive    0   0   0   0
negative    0   0   0   0
negative    0   0   0   0
negative    0   0   0   0
negative    -1  -1  0   0
positive    0   0   0   1
negative    0   0   0   0
negative    0   0   0   0
negative    0   0   0   0
negative    0   0   0   0
negative    0   -1  0   0
positive    -1  -1  -1  0
negative    0   0   0   0
negative    0   0   0   0
positive    0   0   1   0
positive    0   -1  0   0
negative    -1  0   0   0
negative    1   1   1   0
negative    1   1   1   0
positive    1   0   0   0
positive    0   0   0   0
negative    -1  0   0   0
positive    0   -1  -1  0
negative    0   0   0   0
negative    0   0   0   0
negative    1   0   0   0
positive    0   1   1   0

Topic graphical-model graphs statistics

Category Data Science


OK, here are my attempts with R & ggplot2

1 Simple stacked histogram

enter image description here

2 Dodged stacked histogram ~ bacteria

enter image description here

3 Dodged histogram ~ Culture

enter image description here

4 Dodged histogram ~ change

enter image description here

5 Grouped by number of unique 'patterns' Change~Bacteria

enter image description here

6 Grouped by number of unique 'patterns' Change~Bacteria, jittered

enter image description here

7 Grouped by number of unique 'patterns' Change~Bacteria, jittered (const width)

enter image description here

8 Grouped by number of unique 'patterns' Change~Bacteria, jittered (const width)

enter image description here

9 Table with all patterns & its counts

enter image description here

Remark: the charts showing the number of "patterns" do not take into account the fact that the number of "negative" observations is significantly higher than the number of "positive" observations (146 vs 57, see the table). So in some sense the comparison is not fair, but this can be fixed easily.


Very first input: Please confirm if you are really asking about Graphs as there are tones of misunderstanding between plotting and Graph as a mathematical object. In case you mean visualization and not Graph as a math object please let me know to edit your tags and title.

I will continue with my answer anyway as graphs are the right tool for visualization and moreover for analysis of your data even if you touched them accidentally!

You can see your problem from Graph Theory point of view in different ways. I assume cases as nodes and changes as edges in simplest way. You may continue developing the idea to more sophisticated structures.

Let's assume each case is a node in your graph. Then you can model each bacteria with one graph in which there is no edge between two nodes if the change is zero and an edge if there is, where the weight of edge is either 1 or -1 for different cases. Then you come up with 4 graphs on each of which you may do statistical analysis according to network topology.

As a more detailed modeling, you may consider two nodes for each case corresponding to each timestamp and connect them with weights 1 or -1 or not connect them in case the change is zero. To avoid weights you can simply use directed graph in which an edge goes from node of case $X$ in time $t_0$ goes to node of case $X$ in time $t_1$ if the change is one and if it's -1, an edge goes from node of case $X$ in time $t_1$ to node of case $X$ in time $t_0$. The topology of connections also tells a lot in this case.

In both cases the visualization of graph might be intuitive might not. If not you can visualize different statistical measures on nodes, edges, degrees, graphs themselves, etc.

Hope it helps!

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.