You are trying to mix two completely different plotting paradigms. Despite appearing to be a base graphics function, plot
, the hexbin-plot method is actually a grid-based plotting function. Furthermore it's an S4 method which means you need to use showMethods
to actually see it. ( I cannot tell if your par
had any effect or not. (It didn't affect the example I used.)
showMethods('plot', class="hexbin", includeDefs=TRUE)
This is the argument list:
.local <- function (x, style = "colorscale", legend = 1.2,
lcex = 1, minarea = 0.04, maxarea = 0.8, mincnt = 1,
maxcnt = max(x@count), trans = NULL, inv = NULL, colorcut = seq(0,
1, length = min(17, maxcnt)), border = NULL, density = NULL,
pen = NULL, colramp = function(n) LinGray(n, beg = 90,
end = 15), xlab = NULL, ylab = NULL, main = "", newpage = TRUE,
type = c("p", "l", "n"), xaxt = c("s", "n"), yaxt = c("s",
"n"), clip = "on", verbose = getOption("verbose"))
If you wanted to modify its layout you should be working with what is returned as a value:
plot.vp the hexViewport constructed and used.
legend.vp if a legend has been produced, its viewport.
If you look at the code it appears that it will accept an argument "legend" which is the width of the legend viewport in inches, so try modifying that:
plot(bin, legend=1.0)
By the way; the confusion about ggplot comes from one of the plotting methods being named gplot.hexbin, but that "g" is a reference to "grid" rather than to "ggplot"