Closed mdsumner closed 5 years ago
I am assuming we can't do this yet?
I get this error when I try the example
Error in UseMethod("sptable") : no applicable method for 'sptable' applied to an object of class "SOmap" Error in SOauto_map(x) : don't understand how to get lon,lat from 'x'
we can't, it's quite a bit of work actually - and might even need a new function, in fact that's probably smarter - a new function to eat the output of SOauto_map, to drive refactoring of the internal logic - then one day consider autophagy - great brainstorming!
is there a simple way to write a plot method for objects of class SOmap? something that is essentially:
map<-SOauto_map(x,y) plot(map)
which internally does plot(map$bathy, col=bluepal,) plot(map$coastline, add=TRUE) plot(map$graticule, add=TRUE, col=8)
etc..?
Well you could: in that scenario SOauto_map
becomes a constructor function that just returns an object, of class SOmap
, with all the data and parameter values needed for a given map. Then, as you say, that class has a plot method that runs the appropriate sequence of plot calls. One can then also modify the SOmap
object by manipulating that stored data.
It mostly does that already, the only thing that is not done atm is the ability to replot an assigned SOmap object without running the SOauto_map
function again.
Then I think you just need to take all the plot
and equivalent calls out of the current function, and add a new function:
#' @method plot SOmap
#' @export
plot.SOmap <- function (x, y, ...) {
## all the actual plotting here
}
Sounds like volunteering @raymondben....
ok, see https://github.com/AustralianAntarcticDivision/SOmap/tree/nomnomnom as a starting point
SOauto_map() ## returns object which is printed to console, this gets passed to print method and thus plotted
p <- SOauto_map() ## object in p but not plotted yet
p ## print it (print method calls plot)
plot(p) ## explicitly plot it
## change stuff
p$bathy_palette <- rev(p$bathy_palette)
## replot
p
Looks great. Thoughts on converting SOmap() to do the same? I feel like it would take a bit of work.
Will have a crack this arv
You two are doing a great job here
This branch now merged into master, so closing the issue
Allow the auto to ingest itself:
We need families of modification processes to update the data.