sebastian.rohrer at basf.com
2009-Oct-21 11:01 UTC
[R] ggplot2: Histogram with negative values on x-axis doesn't work
I have a dataset that contains numbers between -10 and 0. E.g. x = c(-9.23, -9.56, -1.40, ...) If I no do a> qplot(x, geom="histogram")I get the error: Error: position_stack requires non-overlapping x intervals Strangely, the following both work:> qplot(x * -1, geom="histogram") > qplot(x+100, geom="histogram")Has anyone else encountered this? Is this a bug in ggplot2, or do I get anything completely wrong here? Versions: R: 2.9.1, ggplot2: 0.8.3 [[alternative HTML version deleted]]
Karl Ove Hufthammer
2009-Oct-21 12:11 UTC
[R] ggplot2: Histogram with negative values on x-axis doesn't work
In article <OF1D427087.01614A71-ONC1257656.003BFAB8-C1257656.003C88F8 @basf-c-s.be>, sebastian.rohrer at basf.com says...> I have a dataset that contains numbers between -10 and 0. E.g. x = > c(-9.23, -9.56, -1.40, ...) > If I no do a > > qplot(x, geom="histogram") > I get the error: > Error: position_stack requires non-overlapping x intervals > Strangely, the following both work: > > qplot(x * -1, geom="histogram") > > qplot(x+100, geom="histogram")I can reproduce it with for example x=c(-9.23, -9.56, -1.40) But adding a single positive number, even .0000001, fixes it, while adding a similar negative number introduces a new error message, so it really looks like a bug in ggplot2 when all the values are negative. Report it to the ggplot2 author or the ggplot2 mailing list. -- Karl Ove Hufthammer
Reasonably Related Threads
- WG: Problem during porting R-2.7.2 on HP-UP 11.11 PA-Risc
- Stacked geom_bar with aggregated SE -ggplot2
- Seqfault, Address 0, track X11() (PR#11231)
- Orden de categorías en gráficos de barras (position = "stack")
- Orden de categorías en gráficos de barras (position = "stack")