Skip to content

Commit

Permalink
version 1.27.1
Browse files Browse the repository at this point in the history
  • Loading branch information
edzer authored and gaborcsardi committed Aug 19, 2015
1 parent b948bad commit 9f4ec26
Show file tree
Hide file tree
Showing 16 changed files with 232 additions and 52 deletions.
13 changes: 7 additions & 6 deletions DESCRIPTION
@@ -1,15 +1,15 @@
Package: hexbin
Version: 1.27.0
Date: 2014-08-08
Version: 1.27.1
Date: 2015-08-19
Title: Hexagonal Binning Routines
Author: Dan Carr <dcarr@voxel.galaxy.gmu.edu>, ported by Nicholas
Lewin-Koh and Martin Maechler <maechler@stat.math.ethz.ch>,
contains copies of lattice function written by Deepayan Sarkar
contains copies of lattice functions written by Deepayan Sarkar
<deepayan.sarkar@r-project.org>
Maintainer: Edzer Pebesma <edzer.pebesma@uni-muenster.de>
Depends: R (>= 2.0.1), methods
Imports: lattice, grid, graphics, grDevices, stats, utils
Suggests: marray, affy, Biobase
Suggests: marray, affy, Biobase, limma
Description: Binning and plotting functions for hexagonal bins. Now
uses and relies on grid graphics and formal (S4) classes and
methods.
Expand All @@ -19,6 +19,7 @@ Collate: lattice.R BTC.R BTY.R grid.hexagons.R grid.hexlegend.R hbox.R
LOCS.R MAG.R RB.R smoothHexbin.R
License: GPL-2
NeedsCompilation: yes
Packaged: 2014-08-09 14:47:07 UTC; edzer
URL: http://github.com/edzer/hexbin
Packaged: 2015-08-19 15:11:53 UTC; edzer
Repository: CRAN
Date/Publication: 2014-08-09 16:56:37
Date/Publication: 2015-08-19 17:28:20
26 changes: 15 additions & 11 deletions MD5
@@ -1,5 +1,5 @@
b8c6e7f6b0230cdf61f0976d387c7a44 *ChangeLog
b66be4500e652afd8a98305a38f240da *DESCRIPTION
58f0420f8288b4faae52aba21669bc3d *DESCRIPTION
9129a733a21f780d50b1c3bb85da0047 *NAMESPACE
98a77d0235bb074f09aa7675358b8650 *R/BTC.R
b8083617bec9ef2a20bf2fb31d1f50cb *R/BTY.R
Expand All @@ -11,29 +11,30 @@ c25363a22b3f824d1f25997179b74434 *R/RB.R
97262cc9f616661bf71e4686225f6c17 *R/grid.hexagons.R
cd88d10aa75a6666b296efff0ac1f355 *R/grid.hexlegend.R
503b110bf985d5c12a0d514c333dc81e *R/hbox.R
af47bcebc0383679d4d0698942a6c868 *R/hdiffplot.R
85315d7d03d9e9db93d3a14d62b960af *R/hexPlotMA.R
5728b07de4711701d1b2acf6a9f06fe9 *R/hexViewport.R
ad4a901fb8fc48deb4f76ad3d797ecd9 *R/hdiffplot.R
d53fcb4dabb71c0154e881648c6b13da *R/hexPlotMA.R
e5cb8c5f3ba8f183d4c69e50f153f845 *R/hexViewport.R
48ab7518d22b3310dab41acae327c743 *R/hexbin.s4.R
5d66d35fa92d45957684ee3375513e28 *R/hexbinList.R
ae5724baa7c3661621ed0018287fc6ca *R/hexbinplot.R
53e8c6ea014e06b21e56b8e447a0dad5 *R/hexpanel.R
249d47000fdc8b641cf6ed2ee6f640bb *R/hexplom.R
0b7181a5ae4cbc780f46041886fc80e8 *R/hexutil.R
7938c3dc88323c01ff2a2a040d29c19d *R/lattice.R
acf4489ea175f01eb1659a420183e155 *R/lattice.R
449d6bbfb6927f39383b586ffce19eb1 *R/smoothHexbin.R
b943a359274739b935bb5885d733d42d *TODO
2eab3d71f8ccae48cacbc328f428d2bd *build/vignette.rds
408e6e0599f15c991715933ddd85400f *README.md
53e586900ba0c452c12ec7aed3d20295 *TODO
dd1765c586720d0a4c7c5064fce7da74 *build/vignette.rds
cfa9343134507d8eaf7386167ea1243d *data/NHANES.rda
a6e0f6f67abc1c4d94ad6b2d33860fe2 *inst/doc/hexagon_binning.R
ed9dbcabcbb9240445d6dac2de22ba5f *inst/doc/hexagon_binning.Rnw
4550e584d1ad491edcb547bd4ec28845 *inst/doc/hexagon_binning.pdf
3b3cb098160c79abc4d739397d315ff3 *man/NHANES.Rd
bfc5169b22c653bb5912e9c3e92f3207 *man/colramp.Rd
428bdc3a94aedc5816d0cbc72e4271d7 *man/erode.hexbin.Rd
94a1639600897389f489b6b836362d82 *man/erode.hexbin.Rd
47a11326b5056014da626fe8c3c5b8e8 *man/getHMedian.Rd
59c3d8f5ac3b772a88e5b0a5c0b96d28 *man/gplot.hexbin.Rd
d342c3bc65cea7fb4b2103dd7bebeabf *man/grid.hexagons.Rd
651ab732e881463b6516824c162e35ac *man/gplot.hexbin.Rd
4f14ff188dcc89ced1434511b0da5dc0 *man/grid.hexagons.Rd
6e12f30832b4d71515a91bb8c448049d *man/grid.hexlegend.Rd
5f2695c8af33d84b154a61e3463859e9 *man/hboxplot.Rd
eb4f91c7c9c4482122d7c9ee209e93b6 *man/hcell2xy.Rd
Expand Down Expand Up @@ -68,6 +69,9 @@ f8fb4b9ec5a1dbc174102d40377ce885 *src/herode.f
ddcf0653ed6863dd0260e1f58349356a *tests/hdiffplot.R
66fb0e8391d2b94fbdb2633ac4d70e21 *tests/hdiffplot.Rout.save
efe67770786c28cc2bfceef357376f7a *tests/hray.R
24021c6251d46ad71065e3705e04479d *tests/hray.Rout.save
6dca74e0501c54cede56d657a1c0c632 *tests/large.R
98321f01b4ed346aa059aec1aa3c637a *tests/large.Rout.save
f94ffad94528308a3483bf6f4088fa70 *tests/viewp-ex.R
049e6d8eb7c68d12f2e78f48b26c84f5 *vignettes/hexagon_binning.Rnw
53478aa4cafb6fb935b12b7c982a667d *tests/viewp-ex.Rout.save
d6c9a9e05a1165a6e0da8b309303082b *vignettes/hexagon_binning.Rnw
2 changes: 1 addition & 1 deletion R/hdiffplot.R
Expand Up @@ -169,7 +169,7 @@ hdiffplot <-
grid.text(xlab, y = unit(-2, "lines"), gp = gpar(fontsize = 16))
if(nchar(ylab) > 0)
grid.text(ylab, x = unit(-2, "lines"), gp = gpar(fontsize = 16), rot = 90)
if(nchar(main) > 0)
if(sum(nchar(main)) > 0)
grid.text(main, y = unit(1, "npc") + unit(1.5, "lines"),
gp = gpar(fontsize = 18))

Expand Down
37 changes: 21 additions & 16 deletions R/hexPlotMA.R
Expand Up @@ -13,13 +13,17 @@ plotMAhex <- function (MA, array = 1, xlab = "A", ylab = "M",
xaxt = c("s", "n"), yaxt = c("s", "n"),
verbose = getOption("verbose"))
{
if (!requireNamespace("marray", quietly = TRUE))
stop("cannot process objects without package marray")
if (!requireNamespace("limma", quietly = TRUE))
stop("cannot process objects without package limma")
if(is.null(main))main <- ""
switch(class(MA),marrayRaw={
x <- maA(MA[,array])
y <- maM(MA[,array])
w <- maW(MA[,array])
x <- marray::maA(MA[,array])
y <- marray::maM(MA[,array])
w <- marray::maW(MA[,array])
},RGList = {
MA <- MA.RG(MA[, array])
MA <- limma::MA.RG(MA[, array])
array <- 1
x <- MA$A
y <- MA$M
Expand Down Expand Up @@ -58,33 +62,34 @@ plotMAhex <- function (MA, array = 1, xlab = "A", ylab = "M",
y <- MA[, array] - x
w <- NULL
}, ExpressionSet = {
if(!require(Biobase))
if (!requireNamespace("Biobase", quietly = TRUE))
stop("cannot process ExpressionSet objects without package Biobase")
narrays <- ncol(exprs(MA))
narrays <- ncol(Biobase::exprs(MA))
if (narrays < 2)
stop("Need at least two arrays")
if (narrays > 5)
x <- apply(exprs(MA), 1, median, na.rm = TRUE)
x <- apply(Biobase::exprs(MA), 1, median, na.rm = TRUE)
else
x <- rowMeans(exprs(MA), na.rm = TRUE)
y <- exprs(MA)[, array] - x
x <- rowMeans(Biobase::exprs(MA), na.rm = TRUE)
y <- Biobase::exprs(MA)[, array] - x
w <- NULL
if (missing(main))
main <- colnames(exprs(MA))[array]
main <- colnames(Biobase::exprs(MA))[array]
}, AffyBatch = {
if(!require(affy)| !require(Biobase))
if (!requireNamespace("Biobase", quietly = TRUE) ||
!requireNamespace("affy", quietly = TRUE))
stop("cannot process AffyBatch objects without package Biobase and affy")
narrays <- ncol(exprs(MA))
narrays <- ncol(Biobase::exprs(MA))
if (narrays < 2)
stop("Need at least two arrays")
if (narrays > 5)
x <- apply(log2(exprs(MA)), 1, median, na.rm = TRUE)
x <- apply(log2(Biobase::exprs(MA)), 1, median, na.rm = TRUE)
else
x <- rowMeans(log2(exprs(MA)), na.rm = TRUE)
y <- log2(exprs(MA)[, array]) - x
x <- rowMeans(log2(Biobase::exprs(MA)), na.rm = TRUE)
y <- log2(Biobase::exprs(MA)[, array]) - x
w <- NULL
if (missing(main))
main <- colnames(exprs(MA))[array]
main <- colnames(Biobase::exprs(MA))[array]
}, stop("MA is invalid object"))
if (!is.null(w) && !zero.weights) {
i <- is.na(w) | (w <= 0)
Expand Down
9 changes: 6 additions & 3 deletions R/hexViewport.R
Expand Up @@ -241,9 +241,12 @@ hexVP.loess <- function(hbin, hvp = NULL, span = 0.4, col = 'red', n = 200)
fit <- loess(hbin@ycm ~ hbin@xcm, weights = hbin@count, span = span)
if(!is.null(hvp)) {
pushHexport(hvp, clip = 'on')
grid.lines(seq(0,16, length = n),
predict(fit,seq(0,16, length = n)),
gp = gpar(col = col), default.units = 'native')
# grid.lines(seq(0,16, length = n),
# predict(fit,seq(0,16, length = n)),
# gp = gpar(col = col), default.units = 'native')
grid.lines(seq(hbin@xbnds[1], hbin@xbnds[2], length = n),
predict(fit,seq(hbin@xbnds[1], hbin@xbnds[2], length = n)),
gp = gpar(col = col), default.units = 'native')
popViewport()
}
invisible(fit)
Expand Down
12 changes: 6 additions & 6 deletions R/lattice.R
Expand Up @@ -7,12 +7,12 @@
#
# checking dependencies in R code ... NOTE
# Unexported objects imported by ':::' calls:
# lattice:::cond.orders’ ‘lattice:::construct.scales
# lattice:::cupdate’ ‘lattice:::limits.and.aspect
# lattice:::trellis.skeleton
# See the note in ?`:::` about the use of this operator.
# See the information on DESCRIPTION files in the chapter Creating R
# packages of the Writing R Extensions manual.
# lattice:::cond.orders lattice:::construct.scales
# lattice:::cupdate lattice:::limits.and.aspect
# lattice:::trellis.skeleton
# See the note in ?::: about the use of this operator.
# See the information on DESCRIPTION files in the chapter Creating R
# packages of the Writing R Extensions manual.

# the files in lattice carry the following copyright notice:

Expand Down
5 changes: 5 additions & 0 deletions README.md
@@ -0,0 +1,5 @@
hexbin
======
[![Build Status](https://travis-ci.org/edzer/hexbin.png?branch=master)](https://travis-ci.org/edzer/hexbin)

An R Package with binning and plotting functions for hexagonal bins.
5 changes: 5 additions & 0 deletions TODO
@@ -1,3 +1,8 @@
--------------
Aug 10, 2014
o get rid of functions in lattice.R, which were copied from lattice

--------------
o The new 3D plots -- should rather make the new functions "internal"
and choosable with *arguments* from given functions !

Expand Down
Binary file modified build/vignette.rds
Binary file not shown.
2 changes: 1 addition & 1 deletion man/erode.hexbin.Rd
Expand Up @@ -57,7 +57,6 @@ erode.hexbin(hbin, cdfcut = 0.5)
}

\examples{
library("grid")
set.seed(153)
x <- rnorm(10000)
y <- rnorm(10000)
Expand All @@ -79,6 +78,7 @@ plot(bin,style= "lat", minarea=1, maxarea=1,
%% FIXME: {compare with example in "hexbin0"}
grid.hexagons(erodebin,style= "lat", minarea=1, maxarea=1,pen="green")
xy <- hcell2xy(erodebin)
library("grid")
grid.text(lab = as.character(erodebin@erode), xy$x, xy$y,
gp = gpar(col="white", cex=0.65))

Expand Down
2 changes: 1 addition & 1 deletion man/gplot.hexbin.Rd
Expand Up @@ -100,7 +100,6 @@ gplot.hexbin(x, style = "colorscale", legend = 1.2, lcex = 1,
\code{\link{hdiffplot}}. %%, \code{\link{hmatplot}}.
}
\examples{
library("grid")
## 1) simple binning of spherical normal:
x <- rnorm(10000)
y <- rnorm(10000)
Expand Down Expand Up @@ -132,6 +131,7 @@ P <- plot(bin, style="lattice", legend=FALSE,
minarea=1, maxarea=1, border="white")
##
%% FIXME!
library("grid")
pushHexport(P$plot.vp)
xy <- hcell2xy(bin)
# to show points rather than counts :
Expand Down
2 changes: 1 addition & 1 deletion man/grid.hexagons.Rd
Expand Up @@ -141,7 +141,6 @@ grid.hexagons(dat, style = c("colorscale", "centroids", "lattice",
}

\examples{
library("grid")
set.seed(506)
x <- rnorm(10000)
y <- rnorm(10000)
Expand All @@ -167,6 +166,7 @@ P <- plot(hb2, type="n", main = "Bivariate mixture (10000)")# asp=1
pushHexport(P$plot.vp)
grid.hexagons(hb2, style= "lattice", border = gray(.1), pen = gray(.6),
minarea = .1, maxarea = 1.5)
library("grid")
popViewport()

## How to treat 'singletons' specially:
Expand Down
52 changes: 52 additions & 0 deletions tests/hray.Rout.save
@@ -0,0 +1,52 @@

R version 3.1.1 (2014-07-10) -- "Sock it to Me"
Copyright (C) 2014 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(hexbin)
>
> set.seed(572)
>
> x <- rnorm(100)
> y <- rnorm(100)
> val <- rnorm(100)
> inc <- abs(rnorm(100,sd = .3))
> loB <- val-inc
> hiB <- val+inc
>
> if(exists("hray", mode="function")) { # 'real soon now'
+
+ ## no confidence bounds
+ plot(x,y,type = 'n')
+ hray(x,y,val)
+
+ ## confidence bounds
+ plot(x,y,type = 'n')
+ hray(x,y,val, lo = loB, hi = hiB)
+
+ ## clockwise orientation
+ plot(x,y,type = 'n')
+ hray(x,y,val, loB, hiB, clockwise = TRUE)
+
+ ## no tics and small filled dots
+ plot(x,y,type = 'n')
+ hray(x,y,val, loB, hiB, ticlength = FALSE,
+ dotside = 20, dotlength = .025, dotden = -1)
+
+ }
>
> proc.time()
user system elapsed
0.252 0.012 0.258
60 changes: 60 additions & 0 deletions tests/large.Rout.save
@@ -0,0 +1,60 @@

R version 3.1.1 (2014-07-10) -- "Sock it to Me"
Copyright (C) 2014 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(hexbin)
>
> if(FALSE) { ## the following is still quite a bit from working/useful :
+
+ ## what should that do? set a palette?
+ rgb <- matrix(c(
+ 15,15,15,
+
+ 0, 0, 0,
+ 1, 9,15,
+ 9,15, 9,
+ 15, 9, 9,
+
+ 0, 0, 0,
+ 0, 0, 0,
+ 0, 0, 0,
+ 0, 0, 0,
+ 0, 0, 0,
+ 0, 0, 0,
+
+ 9, 9, 9,
+ 0, 2, 7,
+ 0, 7, 1,
+ 8, 1, 1,
+
+ 15, 2, 2,
+ 11, 1, 1,
+ 8, 1, 1,
+ 5, 1, 1,
+ 5, 1, 1,
+ 15,15,15), ncol = 3, byrow = TRUE)
+
+ ##ps.options(rasters=600,color=rgb/15,background=2)
+ ##ps.options(color=rgb/15,background=2)
+ postscript("large.ps",width = 10,height = 7.5)
+
+ plot.hexbin(ans.25mil, style = "nest", lcex = .9)
+
+ }## FALSE, i.e. nothing done
>
> proc.time()
user system elapsed
0.240 0.032 0.265

0 comments on commit 9f4ec26

Please sign in to comment.