I'm trying to plot a histogram with 2 sets of data using ggplot2. My dataset has 418 values to plot, with 2 groups of data (so there will be 2 sets of coloured bars on my histogram). Annoyingly I can't reproduce the problem with the iris dataset:
library(ggplot2)
ggplot(iris, aes(x=iris[,1], fill=iris[,5])) +
geom_histogram(binwidth=.5,alpha=.5)
This creates a histogram fine. When I try it on my data I get:
Error : cannot allocate vector of size 4.0 Gb
In addition: Warning messages:
1: In anyDuplicated.default(breaks) :
Reached total allocation of 16366Mb: see help(memory.size)
2: In anyDuplicated.default(breaks) :
Reached total allocation of 16366Mb: see help(memory.size)
3: In anyDuplicated.default(breaks) :
Reached total allocation of 16366Mb: see help(memory.size)
4: In anyDuplicated.default(breaks) :
Reached total allocation of 16366Mb: see help(memory.size)
Error in UseMethod("scale_dimension") :
no applicable method for 'scale_dimension' applied to an object of class "NULL"
I have 16GB of memory, so producing a plot with 418 data points shouldn't be an issue.
Any help much appreciated.
It turns out that my data still won't plot, even when referring to column names. I think this is due to the range in the data. After log transforming the data, the histogram plots. It seems that ggplot2 or R as a whole doesn't like a range of 1-165476109 which is understandable...
