genPlot(var, iso3 = "SSA", pal = character(0), layout = "default", style = "default", n = integer(0), width = switch(layout, default = 640, print = 5, thumbnail = 120), height = switch(layout, default = 640, print = 5, thumbnail = 120), units = switch(layout, default = "px", print = "in", thumbnail = "px"), res = switch(layout, print = 300, NA), ...)
classIntervals
style
classIntervals
n
argument
to control the number of breaksunits
is specified)units
is specified)png
png
, e.g. pointsizepng
options (e.g. "kmeans" or "pretty") or "default" to use default breaksMethod to plot HarvestChoice rasters with mutiple layout and symbology options.
See examples below. Note that calling genPlot(...)
is equivalent to calling
the convenience function hcapi(..., format="png")
.
API call: generate 2 plots showing farming systems and 2012 population density for Ghana
$ curl http://hcapi.harvestchoice.org/ocpu/library/hcapi3/R/hcapi \
-d '{"var":["FS_2012_TX", "PD12_TOT"], "iso3":"GHA", "format":"png"}' \
-X POST -H 'Content-Type:application/json'
--
/ocpu/tmp/x03d5aa8e98/R/.val
/ocpu/tmp/x03d5aa8e98/stdout
/ocpu/tmp/x03d5aa8e98/source
/ocpu/tmp/x03d5aa8e98/console
/ocpu/tmp/x03d5aa8e98/info
/ocpu/tmp/x03d5aa8e98/files/DESCRIPTION
/ocpu/tmp/x03d5aa8e98/files/FS_2012_TX.GHA.png
/ocpu/tmp/x03d5aa8e98/files/PD12_TOT.GHA.png
GET all generated plots in a ZIP archive
$ wget http://hcapi.harvestchoice.org/ocpu/tmp/x03d5aa8e98/zip
# Generate standard raster plot of 2012 population density for sub-Saharan Africa x <- genPlot("PD12_TOT", pal="OrRd") x[1] "PD12_TOT.png"# Generate 3 raster plots for Ghana with legend and title but not axes x <- genPlot(c("AEZ16_CLAS", "cass_h"), iso3="GHA", layout="print") x[1] "AEZ16_CLAS.GHA.print.png" "cass_h.GHA.print.png"# Generate 3 raster plots for Nigeria with the specified dimensions x <- genPlot(c("FS_2012", "yield_l_cv", "soc_d15"), iso3="NGA", width=5, height=5, units="in", res=200, pointsize=8) x[1] "FS_2012.NGA.png" "yield_l_cv.NGA.png" "soc_d15.NGA.png"