Skip to content
Prev 280796 / 398503 Next

ggplot2: behaviour with empty datasets

For example, prepare like this
Then a call to
produces the error
And a call to
plots both a cross (shape = 4) and circle (shape = 1) on position
(0, 0). However, as expected, only a cross should be plotted because
`dt.2' is empty.

So with the current behaviour, if someone writes a script to plot
datasets automatically and distinguish between subsets, he will need
to write different code path for empty and non-empty data subsets.
I think ggplot2 can just choose to "plot nothing" for empty data
subsets, and only produce error when the dataset (union of a subsets) to
plot is completely empty. This can make scripting easier based on
ggplot2.