Am doing some vector plots with the arrows() function. Works well. But what I need to do is supply an arrow for scaling for the reader. I need to plot an arrow of some known magnitude somewhere on the page (preferably outside the bounds of the plot, so that it can be seen clearly) with some text underneath it that says, for instance, "10 kg-m/sec". Any ideas? Thanks. [[alternative HTML version deleted]]
On Tue, 2009-12-08 at 13:42 -0500, Cable, Samuel B Civ USAF AFMC AFRL/RVBXI wrote:> Am doing some vector plots with the arrows() function. Works well. But > what I need to do is supply an arrow for scaling for the reader. I need > to plot an arrow of some known magnitude somewhere on the page > (preferably outside the bounds of the plot, so that it can be seen > clearly) with some text underneath it that says, for instance, "10 > kg-m/sec". Any ideas? Thanks.You can plot outside the plotting region using the 'xpd' plotting parameter: plot(1:10, 1:10) ## dummy plot op <- par(xpd = TRUE) ## change clipping parameter & save defaults arrows(9, 10.75, 10, 10.75, length = 0.1) ## draw reference arrow text(9.5, 11, labels = expression(10 ~ kg ~ m ~ sec^{"-1"})) ## add key par(op) ## reset plotting parameter defaults You'll probably need to tweak the expression to get the units you wanted. HTH G -- %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% Dr. Gavin Simpson [t] +44 (0)20 7679 0522 ECRC, UCL Geography, [f] +44 (0)20 7679 0565 Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk Gower Street, London [w] http://www.ucl.ac.uk/~ucfagls/ UK. WC1E 6BT. [w] http://www.freshwaters.org.uk %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
On 12/09/2009 05:42 AM, Cable, Samuel B Civ USAF AFMC AFRL/RVBXI wrote:> Am doing some vector plots with the arrows() function. Works well. But > what I need to do is supply an arrow for scaling for the reader. I need > to plot an arrow of some known magnitude somewhere on the page > (preferably outside the bounds of the plot, so that it can be seen > clearly) with some text underneath it that says, for instance, "10 > kg-m/sec". Any ideas? Thanks. > >Hi Samuel, To add to what Gavin wrote, you can see code for a key of this sort in the lengthKey function in the plotrix package. Jim
Thanks, all, for the help. Much obliged. I realize now that I should have said that I am using lattice graphics. The par() command has not been helpful in convincing lattice to plot outside of the default window. Any other advice is appreciated. Thanks again. [[alternative HTML version deleted]]