summary: how to make image.plot print a subtitle between the title and the image, rather than under the image? details: I've got a project https://github.com/TomRoche/ioapi-hack-R that illustrates the use of (et al) the R packages {ncdf4, fields, M3} for processing and visualizing IOAPI data. The data being visualized consists of a series of layers (mostly representing emissions from a particular tuple of agricultural {cultivar, cultivation technique}) over a surface (in the upper midwest US). I'm currently plotting https://github.com/downloads/TomRoche/ioapi-hack-R/compare.DN2.layers.pdf each layer, and including some information about the layer in a title and subtitle. The title is where I want it--above the image--but the subtitle is printing below the image; I'd prefer it between the title and the image. Can this be done? FWIW, the code that plots (in https://github.com/TomRoche/ioapi-hack-R/blob/master/plotLayersForTimestep.r ) is like if (data to plot is not all NA) { # determine quantiles, then image.plot(plot.list, xlab="", ylab="", axes=F, col=colors(100), axis.args=list(at=quantiles, labels=quantiles.formatted), main=title, sub=subtitle) lines(map) } else { plot(0, type="n", axes=F, xlab="", ylab="", xlim=range(x.centers), ylim=range(y.centers), main=title, sub=subtitle) lines(map) } # end testing data TIA, Tom Roche <Tom_Roche at pobox.com>
Doug Nychka
2012-May-01 18:33 UTC
[R] [fields:image.plot] subtitle under title (not image)?
Tom, The sub argument will always put text at the bottom -- this is all plotting in R not just image.plot If you want two lines in the title just build in a new line: z<- outer( 1:15, 1:10,"+") image.plot( z, main="the title \n the subtitle") Best, Doug ----------------------------------------------------------------------------- Doug Nychka, Institute for Mathematics Applied to Geosciences National Center for Atmospheric Research Boulder, CO Email: nychka "AT" ucar "DOT" edu Web: www.image.ucar.edu/~nychka Voice: 303-497-1711 FAX: 303-497-1298 Business Cell: 303-725-3199 On May 1, 2012, at 10:25 AM, Tom Roche wrote:> > summary: how to make image.plot print a subtitle between the title and > the image, rather than under the image? > > details: > > I've got a project > > https://github.com/TomRoche/ioapi-hack-R > > that illustrates the use of (et al) the R packages {ncdf4, fields, M3} > for processing and visualizing IOAPI data. The data being visualized > consists of a series of layers (mostly representing emissions from a > particular tuple of agricultural {cultivar, cultivation technique}) > over a surface (in the upper midwest US). I'm currently plotting > > https://github.com/downloads/TomRoche/ioapi-hack-R/compare.DN2.layers.pdf > > each layer, and including some information about the layer in a title > and subtitle. The title is where I want it--above the image--but the > subtitle is printing below the image; I'd prefer it between the title > and the image. Can this be done? FWIW, the code that plots (in > > https://github.com/TomRoche/ioapi-hack-R/blob/master/plotLayersForTimestep.r > > ) is like > > if (data to plot is not all NA) { > # determine quantiles, then > image.plot(plot.list, xlab="", ylab="", axes=F, col=colors(100), > axis.args=list(at=quantiles, labels=quantiles.formatted), > main=title, sub=subtitle) > lines(map) > } else { > plot(0, type="n", axes=F, xlab="", ylab="", > xlim=range(x.centers), ylim=range(y.centers), > main=title, sub=subtitle) > lines(map) > } # end testing data > > TIA, Tom Roche <Tom_Roche@pobox.com>[[alternative HTML version deleted]]
Reasonably Related Threads
- [newbie] how to find and combine geographic maps with particular features?
- [fields] image.plot abends with NAs in image.plot.info
- decorating API in R
- [ncdf4] error converting GEIA data to netCDF
- [newbie] failure to plot a RasterLayer with raster::plot or fields::image.plot