Skip to content

ggplot2, geom_hline and facet_grid

1 message · Small Sandy (NHS Greater Glasgow & Clyde)

#
Hi

I have a long data set on which I want to do Bland-Altman style plots for each rhythm type
Using ggplot2, when I use geom_hline with facet_grid I get an extra set of empty panels.
I can't get it to do it with the "Diamonds" data supplied with the package so here is a (much abbreviated) example:
cvd_basestudy ecd_rhythm fixed_time variable_time
1       CBP05J02         AF    30.9000       29.4225
2       CBP05J02         AF    33.1700       32.0350
3       CBP05J02         AF    32.5700       30.2775
4       CBP05J02         AF    32.0550       33.7275
5       CBP05J02      SINUS    30.9175       28.3475
6       CBP05J02      SINUS    30.5725       29.7450
7       CBP05J02      SINUS    33.0000       31.1550
9       CBP05J02      SINUS    31.8350       30.7000
10      CBP05J02      SINUS    34.0450       33.4800
11      CBP05J02      SINUS    31.3975       29.8150
If I take out the geom_hline I get the plots I would expect.

It doesn't seem to make any difference if I get the mean and difference separately.

Can anyone explain this and tell me how to avoid it (and why does it work with the Diamonds data set?

Any help much appreciated - thanks.

Sandy

Sandy Small
Clinical Physicist
NHS Forth Valley
and
NHS Greater Glasgow and Clyde

********************************************************************************************************************

This message may contain confidential information. If yo...{{dropped:21}}