Regarding hexbin in R...
1
0
Entering edit mode
Wells Oliver ▴ 20
@wells-oliver-3589
Last seen 10.2 years ago
Hello all. I'm trying to figure out why plotting one hexbin will work and one will not. The broken one: library(hexbin) hits = list(x=c(121.48999999999999, 34.140000000000001), y=c(99.400000000000006, 66.269999999999996)) bin <- hexbin(hits$x, hits$y) plot(bin) Yields: Error in cut.default(rcnt, colorcut, labels = FALSE) : invalid number of intervals However, hits = list(x=rnorm(1000), y=rnorm(1000)) bin <- hexbin(hits$x, hits$y) plot(bin) Works fine. The thing is printing hits in the former and latter instances both yield a similar data structure. Any ideas? Thank you. -- Wells Oliver wells@submute.net [[alternative HTML version deleted]]
hexbin hexbin • 1.7k views
ADD COMMENT
0
Entering edit mode
Naomi Altman ★ 6.0k
@naomi-altman-380
Last seen 3.6 years ago
United States
I think the problem is that the data are too sparse. Hexbin essentially creates bins for a histogram, which in the first case only has 2 object, total. Why don't you have a look in "bin" in both cases to see what you have. --Naomi At 03:36 PM 7/23/2009, Wells Oliver wrote: >Hello all. I'm trying to figure out why plotting one hexbin will work and >one will not. >The broken one: > >library(hexbin) >hits = list(x=c(121.48999999999999, 34.140000000000001), >y=c(99.400000000000006, 66.269999999999996)) >bin <- hexbin(hits$x, hits$y) >plot(bin) > >Yields: > >Error in cut.default(rcnt, colorcut, labels = FALSE) : > invalid number of intervals > >However, > >hits = list(x=rnorm(1000), y=rnorm(1000)) >bin <- hexbin(hits$x, hits$y) >plot(bin) > >Works fine. The thing is printing hits in the former and latter instances >both yield a similar data structure. Any ideas? Thank you. > >-- >Wells Oliver >wells at submute.net > > [[alternative HTML version deleted]] > >_______________________________________________ >Bioconductor mailing list >Bioconductor at stat.math.ethz.ch >https://stat.ethz.ch/mailman/listinfo/bioconductor >Search the archives: >http://news.gmane.org/gmane.science.biology.informatics.conductor Naomi S. Altman 814-865-3791 (voice) Associate Professor Dept. of Statistics 814-863-7114 (fax) Penn State University 814-865-1348 (Statistics) University Park, PA 16802-2111
ADD COMMENT
0
Entering edit mode
Ah, yes, that was likely it, but expanding my data set yields a different error. Replacing hits w: hits = list(x=c(121.48999999999999, 34.140000000000001, 134.53999999999999, 139.56, 123.48999999999999, 87.349999999999994, 151.61000000000001, 49.200000000000003, 120.48, 141.56999999999999, 83.329999999999998, 141.56999999999999, 187.75, 133.53, 46.18, 37.149999999999999, 104.42, 225.90000000000001, 107.43000000000001, 85.340000000000003, 142.56999999999999, 173.69, 90.359999999999999, 81.329999999999998, 84.340000000000003, 41.159999999999997, 74.299999999999997, 184.74000000000001, 109.44, 131.53, 73.290000000000006, 89.359999999999999, 76.310000000000002, 231.93000000000001, 166.66999999999999, 124.5, 62.25, 89.359999999999999, 192.77000000000001, 126.51000000000001, 85.340000000000003, 108.43000000000001, 36.140000000000001, 231.93000000000001, 220.88, 88.349999999999994, 149.59999999999999, 52.210000000000001, 98.390000000000001, 198.80000000000001, 165.66, 153.61000000000001, 190.75999999999999, 191.77000000000001, 192.77000000000001, 132.53, 88.349999999999994), y=c(-99.400000000000006, -66.269999999999996, -94.379999999999995, -21.079999999999998, -105.42, -116.47, -59.240000000000002, -69.280000000000001, -22.09, -80.319999999999993, -127.51000000000001, -13.050000000000001, -37.149999999999999, -91.370000000000005, -102.41, -56.219999999999999, -152.61000000000001, -104.42, -91.370000000000005, -113.45, -120.48, -22.09, -51.200000000000003, -61.240000000000002, -65.260000000000005, -115.45999999999999, -66.269999999999996, -123.48999999999999, -90.359999999999999, -105.42, -125.5, -101.41, -32.130000000000003, -92.370000000000005, -115.45999999999999, -102.41, -53.210000000000001, -130.52000000000001, -72.290000000000006, -103.41, -120.48, -103.41, -111.45, -93.370000000000005, -60.240000000000002, -113.45, -61.240000000000002, -59.240000000000002, -162.65000000000001, -98.390000000000001, -106.43000000000001, -78.310000000000002, -110.44, -113.45, -40.159999999999997, -108.43000000000001, -78.310000000000002)) Now yields: Error in M[, 1] : incorrect number of dimensions Any ideas? x and y both have the same number of records. On Thu, Jul 23, 2009 at 3:01 PM, Naomi Altman <naomi@stat.psu.edu> wrote: > I think the problem is that the data are too sparse. Hexbin essentially > creates bins for a histogram, which in the first case only has 2 object, > total. Why don't you have a look in "bin" in both cases to see what you > have. > > --Naomi > > > At 03:36 PM 7/23/2009, Wells Oliver wrote: > >> Hello all. I'm trying to figure out why plotting one hexbin will work and >> one will not. >> The broken one: >> >> library(hexbin) >> hits = list(x=c(121.48999999999999, 34.140000000000001), >> y=c(99.400000000000006, 66.269999999999996)) >> bin <- hexbin(hits$x, hits$y) >> plot(bin) >> >> Yields: >> >> Error in cut.default(rcnt, colorcut, labels = FALSE) : >> invalid number of intervals >> >> However, >> >> hits = list(x=rnorm(1000), y=rnorm(1000)) >> bin <- hexbin(hits$x, hits$y) >> plot(bin) >> >> Works fine. The thing is printing hits in the former and latter instances >> both yield a similar data structure. Any ideas? Thank you. >> >> -- >> Wells Oliver >> wells@submute.net >> >> [[alternative HTML version deleted]] >> >> _______________________________________________ >> Bioconductor mailing list >> Bioconductor@stat.math.ethz.ch >> https://stat.ethz.ch/mailman/listinfo/bioconductor >> Search the archives: >> http://news.gmane.org/gmane.science.biology.informatics.conductor >> > > Naomi S. Altman 814-865-3791 (voice) > Associate Professor > Dept. of Statistics 814-863-7114 (fax) > Penn State University 814-865-1348 (Statistics) > University Park, PA 16802-2111 > > -- Wells Oliver wells@submute.net [[alternative HTML version deleted]]
ADD REPLY
0
Entering edit mode
Yes, but you might need to make it into a data.frame. A list has no concept of dimension. Kasper On Jul 23, 2009, at 13:07 , Wells Oliver wrote: > Ah, yes, that was likely it, but expanding my data set yields a > different > error. Replacing hits w: > hits = list(x=c(121.48999999999999, 34.140000000000001, > 134.53999999999999, > 139.56, 123.48999999999999, 87.349999999999994, 151.61000000000001, > 49.200000000000003, 120.48, 141.56999999999999, 83.329999999999998, > 141.56999999999999, 187.75, 133.53, 46.18, 37.149999999999999, 104.42, > 225.90000000000001, 107.43000000000001, 85.340000000000003, > 142.56999999999999, 173.69, 90.359999999999999, 81.329999999999998, > 84.340000000000003, 41.159999999999997, 74.299999999999997, > 184.74000000000001, 109.44, 131.53, 73.290000000000006, > 89.359999999999999, > 76.310000000000002, 231.93000000000001, 166.66999999999999, 124.5, > 62.25, > 89.359999999999999, 192.77000000000001, 126.51000000000001, > 85.340000000000003, 108.43000000000001, 36.140000000000001, > 231.93000000000001, 220.88, 88.349999999999994, 149.59999999999999, > 52.210000000000001, 98.390000000000001, 198.80000000000001, 165.66, > 153.61000000000001, 190.75999999999999, 191.77000000000001, > 192.77000000000001, 132.53, 88.349999999999994), > y=c(-99.400000000000006, > -66.269999999999996, -94.379999999999995, -21.079999999999998, > -105.42, > -116.47, -59.240000000000002, -69.280000000000001, -22.09, > -80.319999999999993, -127.51000000000001, -13.050000000000001, > -37.149999999999999, -91.370000000000005, -102.41, > -56.219999999999999, > -152.61000000000001, -104.42, -91.370000000000005, -113.45, -120.48, > -22.09, > -51.200000000000003, -61.240000000000002, -65.260000000000005, > -115.45999999999999, -66.269999999999996, -123.48999999999999, > -90.359999999999999, -105.42, -125.5, -101.41, -32.130000000000003, > -92.370000000000005, -115.45999999999999, -102.41, > -53.210000000000001, > -130.52000000000001, -72.290000000000006, -103.41, -120.48, -103.41, > -111.45, -93.370000000000005, -60.240000000000002, -113.45, > -61.240000000000002, -59.240000000000002, -162.65000000000001, > -98.390000000000001, -106.43000000000001, -78.310000000000002, > -110.44, > -113.45, -40.159999999999997, -108.43000000000001, > -78.310000000000002)) > > Now yields: > > Error in M[, 1] : incorrect number of dimensions > > Any ideas? x and y both have the same number of records. > > > On Thu, Jul 23, 2009 at 3:01 PM, Naomi Altman <naomi at="" stat.psu.edu=""> > wrote: > >> I think the problem is that the data are too sparse. Hexbin >> essentially >> creates bins for a histogram, which in the first case only has 2 >> object, >> total. Why don't you have a look in "bin" in both cases to see >> what you >> have. >> >> --Naomi >> >> >> At 03:36 PM 7/23/2009, Wells Oliver wrote: >> >>> Hello all. I'm trying to figure out why plotting one hexbin will >>> work and >>> one will not. >>> The broken one: >>> >>> library(hexbin) >>> hits = list(x=c(121.48999999999999, 34.140000000000001), >>> y=c(99.400000000000006, 66.269999999999996)) >>> bin <- hexbin(hits$x, hits$y) >>> plot(bin) >>> >>> Yields: >>> >>> Error in cut.default(rcnt, colorcut, labels = FALSE) : >>> invalid number of intervals >>> >>> However, >>> >>> hits = list(x=rnorm(1000), y=rnorm(1000)) >>> bin <- hexbin(hits$x, hits$y) >>> plot(bin) >>> >>> Works fine. The thing is printing hits in the former and latter >>> instances >>> both yield a similar data structure. Any ideas? Thank you. >>> >>> -- >>> Wells Oliver >>> wells at submute.net >>> >>> [[alternative HTML version deleted]] >>> >>> _______________________________________________ >>> Bioconductor mailing list >>> Bioconductor at stat.math.ethz.ch >>> https://stat.ethz.ch/mailman/listinfo/bioconductor >>> Search the archives: >>> http://news.gmane.org/gmane.science.biology.informatics.conductor >>> >> >> Naomi S. Altman 814-865-3791 (voice) >> Associate Professor >> Dept. of Statistics 814-863-7114 (fax) >> Penn State University 814-865-1348 >> (Statistics) >> University Park, PA 16802-2111 >> >> > > > -- > Wells Oliver > wells at submute.net > > [[alternative HTML version deleted]] > > _______________________________________________ > Bioconductor mailing list > Bioconductor at stat.math.ethz.ch > https://stat.ethz.ch/mailman/listinfo/bioconductor > Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor
ADD REPLY

Login before adding your answer.

Traffic: 642 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6