ncss-tech / soilReports

An R package that assists with the setup and operation of a collection of soil data summary, comparison, and evaluation reports. These reports are primarily used by USDA-NRCS soil scientists in both initial and update mapping.
15 stars 5 forks source link

generalize simpleKey creation for categorical rasters #66

Open dylanbeaudette opened 7 years ago

dylanbeaudette commented 7 years ago

Move all of this:

# setup legend configuration
  sK.levels <- levels(x.long$label)
  if(length(sK.levels) < 3) {
    sK.columns <- length(sK.levels)
  } else {
    sK.columns <- 3 # hard-coded for now, TODO: dynamically set for space-saving and readability ()
  }

  # compose legend
  sK <- simpleKey(space='top', columns=sK.columns, text=sK.levels, rectangles = TRUE, points=FALSE)

into its own function and create a heuristic for an optimal number of columns. This would be some kind of compromise between readability and space-saving. Or, it could tie into metadata and known key geometry that "makes sense".

dylanbeaudette commented 7 years ago

I vote for the latter: specify a number of columns that "makes sense". I spent some time today working on a couple of functions that would attempt at reasonable "guesses". However, these didn't give the results I was looking for in either curvature class nor geomorphon summaries.