I also had difficulty when first generating hexbin plots for high dimensional mass cytometry data a couple of years ago. Essentially, the approach of using `hexbin()`

followed by `plot()`

and then `hexVP.abline()`

doesn't work. It's as if the viewport in which `hexVP.abline()`

is attempting to place the line is not 'speaking' with the output from the `plot()`

function (or something along these lines...). It's possible to place it after much hassle and time-wasting.

A better approach is to use a combination of `hexbinplot()`

and a function from the *lattice* package. This will allow you to place the ablines with precision.

```
require(hexbin)
require(lattice)
require(RColorBrewer)
rf <- colorRampPalette(rev(brewer.pal(9,"BuPu")))
hexbinplot(CD28 ~ CD39, data=temp, aspect="1", xbins=500, cex.labels=1.0, cex.title=1.0, colramp=rf,
panel=function(x, y, ...)
{
panel.hexbinplot(x, y, ...)
panel.abline(v=c(0,4), h=c(0,4), col="black", lwd=4, lty=5)
}
)
```

## ------------------------------------

Note that you can also set x- and y-axis limits, and fit a linear regression line:

```
rf <- colorRampPalette(rev(brewer.pal(9,"Spectral")))
hexbinplot(CD28 ~ CD39, data=temp, aspect="1", xbins=500, type="r", cex.labels=1.0, cex.title=1.0, colramp=rf, xlim=c(-3,8), ylim=c(-3,8))
```

## -----------------------

Like the *lattice* package functions, which are great and flexible or plotting data in various ways, it's probably worth an entire day exploring `hexbinplot()`

(if you can convince your supervisor...).

Kevin