# How do I chart ratios, not proportions?

How can I draw a chart for a ratio, not a proportion, when sometimes the ratio is infinity?

Context: I am looking at prescribing of drug A and drug B. I have been drawing bar charts showing prescribing of drug A, per 1000 prescriptions of drug B, over time.

This works great, except when prescriptions of drug B drop to zero. Then I have a problem with my chart, because the proportion is infinity.

How can I visualise the ratio over time, while handling this problem?

• Does prescribing of drug A ever drop to 0? – EdM Apr 13 '16 at 16:32

From a charting perspective, the most straightforward option is to add a marginal strip plot for the b=0 cases, with some indication in the proportion plot of breaks, such as faint lines like here or line breaks. Perhaps a richer option is to apply some kind of data transformation and clipping. Here's a plot of a constrained log(a/b). Now the a:b proportions are symmetrical if that's important (1/1 is in the middle and 2/5 is the same distance as 5/2). However, now there is an issue with both a=0 and with b=0. Here I've clipped those values at 0.01 which is enough to make those values stand out.

• +1. I think this is a good graphical solution. But statistically if small $b$ is a problem then $\log(b/a)$ might be better, particular as there is no mention of $a = 0$. You still have a problem with zeros, which would then be plotted separately below the trace, as lower than any other observed. A more heterodox alternative is to plot $b/a$ on square root or cube root scale. – Nick Cox Apr 13 '16 at 16:42
• Some people would work with $\log[(b + 0.5)/(a + 0.5)]$ but you would need to explain that scale. – Nick Cox Apr 14 '16 at 12:01