Skip to content

ggplot2: behaviour with empty datasets

3 messages · Casper Ti. Vector, Hadley Wickham

#
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.
#
See https://github.com/hadley/ggplot2/issues/31 - I totally agree that
it's annoying.
Hadley

PS.  You are more likely to get helpful responses about ggplot2 on the
ggplot mailing list.

On Fri, Dec 23, 2011 at 7:08 AM, Casper Ti. Vector
<caspervector at gmail.com> wrote:

  
    
#
Thanks, I'll post to that list if the encountered problem is just about
ggplot2.
And from the date of the issue on GitHub it seems that I might need to
manually work around the problem some more times :)
On Fri, Dec 23, 2011 at 08:10:05AM -0600, Hadley Wickham wrote: