hexbin, par("usr"), legend
1
0
Entering edit mode
Jenny Bryan ▴ 110
@jenny-bryan-949
Last seen 10.3 years ago
Are there any plans for changing the behavior of "plot.hexbin" w.r.t. the graphics parameters, especially 'par("usr")'? The current behavior makes it hard to add elements to the plot (which is a really handy and attractive plot, I should add). I know I can create a type="n" plot of the x-range and y-range, use 'hexagons' to add the hexagons, and add other elements to my heart's content .... but then the legend for the hexagon colorramp becomes a difficulty (the documentation is clear that the legend function is not really meant to be called by a user, but only by "plot.hexbin"). Thanks, Jenny -- Jenny Bryan, Ph.D. *----------------------------------* * Assistant Professor * * Department of Statistics and * * the Michael Smith Laboratories * * University of British Columbia * *----------------------------------* 333-6356 Agricultural Road Vancouver, BC V6T 1Z2 Canada http://hajek.stat.ubc.ca/~jenny/ tel: 604.822.6422 fax: 604.822.6960 email: jenny@stat.ubc.ca
• 1.6k views
ADD COMMENT
0
Entering edit mode
@martin-maechler-2
Last seen 5.3 years ago
Switzerland
>>>>> "Jenny" == Jenny Bryan <jenny@stat.ubc.ca> >>>>> on Thu, 21 Oct 2004 10:17:19 -0700 writes: Jenny> Are there any plans for changing the behavior of Jenny> "plot.hexbin" w.r.t. the graphics parameters, Jenny> especially 'par("usr")'? The current behavior makes Jenny> it hard to add elements to the plot (which is a Jenny> really handy and attractive plot, I should add). I Jenny> know I can create a type="n" plot of the x-range and Jenny> y-range, use 'hexagons' to add the hexagons, and add Jenny> other elements to my heart's content .... but then Jenny> the legend for the hexagon colorramp becomes a Jenny> difficulty (the documentation is clear that the Jenny> legend function is not really meant to be called by a Jenny> user, but only by "plot.hexbin"). yes, there are big plans for big changes: The current development version of hexbin will use grid graphics which allows "everything" in principle, but the user utility functions might well be lacking initially -- and you willl have t ouse grid (or lattice) graphics; no par(.), no traditional graphics... Also, the result of hexbin() will be an S4 object instead of a list. There is some unfinished discussion going on, if the old version of hexbin should be kept available in package "hexbin0" -- for those of you who can't update quickly to the new API to hexbin graphics. Jenny> Thanks, Jenny Jenny> -- Jenny Bryan, Ph.D. Jenny> *----------------------------------* * Assistant Jenny> Professor * * Department of Statistics and * * the Jenny> Michael Smith Laboratories * * University of British Jenny> Columbia * *----------------------------------* Jenny> 333-6356 Agricultural Road Vancouver, BC V6T 1Z2 Jenny> Canada http://hajek.stat.ubc.ca/~jenny/ tel: Jenny> 604.822.6422 fax: 604.822.6960 email: Jenny> jenny@stat.ubc.ca Jenny> _______________________________________________ Jenny> Bioconductor mailing list Jenny> Bioconductor@stat.math.ethz.ch Jenny> https://stat.ethz.ch/mailman/listinfo/bioconductor
ADD COMMENT
0
Entering edit mode
Hi Jenny, Just to add to what Martin said; We are working on making hexbin much more flexible. The price for the flexibility is using grid, which isn't bad one you get used to it. Under the new model you can simply do something like > x<-rnorm(10000) > y<-rnorm(10000) > hbin<-hexbin(x,y) > hp<-hexViewport(hbin,offset=unit(1.2,"inches"),mar=NULL,newpage=TRUE) > pushViewport(hp) > grid.rect() > grid.xaxis() > grid.yaxis() > hexagons(hbin,style="centroid") > hloess<-loess(y~x,data=hcell2xy(hbin),hbin@count) > grid.lines(seq(-4,4,by=.2),predict(hloess,seq(-4,4,by=.2)),gp=gpar(c ol='red'),default.units="native") > popViewport() etc .... This example would have been a royal pain in the old version, because of having to manipulate pars and still may not have worked. This should allow very flexible construction of plots, for instance all the different plot types in hexbin are now created using hexViewport. Hope this will be useful Nicholas On Thu, 21 Oct 2004 22:28:43 +0200, "Martin Maechler" <maechler@stat.math.ethz.ch> said: > >>>>> "Jenny" == Jenny Bryan <jenny@stat.ubc.ca> > >>>>> on Thu, 21 Oct 2004 10:17:19 -0700 writes: > > Jenny> Are there any plans for changing the behavior of > Jenny> "plot.hexbin" w.r.t. the graphics parameters, > Jenny> especially 'par("usr")'? The current behavior makes > Jenny> it hard to add elements to the plot (which is a > Jenny> really handy and attractive plot, I should add). I > Jenny> know I can create a type="n" plot of the x-range and > Jenny> y-range, use 'hexagons' to add the hexagons, and add > Jenny> other elements to my heart's content .... but then > Jenny> the legend for the hexagon colorramp becomes a > Jenny> difficulty (the documentation is clear that the > Jenny> legend function is not really meant to be called by a > Jenny> user, but only by "plot.hexbin"). > > yes, there are big plans for big changes: > > The current development version of hexbin will use grid > graphics which allows "everything" in principle, > but the user utility functions might well be lacking initially > -- and you willl have t ouse grid (or lattice) graphics; > no par(.), no traditional graphics... > Also, the result of hexbin() will be an S4 object instead of a list. > > There is some unfinished discussion going on, > if the old version of hexbin should be kept available in package > "hexbin0" -- for those of you who can't update quickly to the > new API to hexbin graphics. > > > > > Jenny> Thanks, Jenny > > Jenny> -- Jenny Bryan, Ph.D. > Jenny> *----------------------------------* * Assistant > Jenny> Professor * * Department of Statistics and * * the > Jenny> Michael Smith Laboratories * * University of British > Jenny> Columbia * *----------------------------------* > Jenny> 333-6356 Agricultural Road Vancouver, BC V6T 1Z2 > Jenny> Canada http://hajek.stat.ubc.ca/~jenny/ tel: > Jenny> 604.822.6422 fax: 604.822.6960 email: > Jenny> jenny@stat.ubc.ca > > Jenny> _______________________________________________ > Jenny> Bioconductor mailing list > Jenny> Bioconductor@stat.math.ethz.ch > Jenny> https://stat.ethz.ch/mailman/listinfo/bioconductor
ADD REPLY

Login before adding your answer.

Traffic: 754 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