Note: this function is still experimental! Use at your own risk.
SOgg(...)
An object of class "SOmap_gg", "SOmanagement_gg", or "SOmap_auto_gg". Printing or plotting this object will cause it to generate a ggplot2 object, which will be returned to the user. If this object is printed or plotted (e.g. to the console) then it will be displayed in the current graphics device as is usual for ggplot2 objects.
if (FALSE) { # \dontrun{
## generate a SOmap object
p <- SOmap2(trim = -45, iwc = TRUE, iwc_labels = TRUE, graticules = TRUE, fronts = TRUE,
mpa = TRUE, mpa_labels = TRUE)
## convert this to a ggplot2-based representation
pg <- SOgg(p)
## display it
pg
## we can see that this object has a bunch of ggplot code embedded inside of it
str(pg)
## and that code can be modified if desired
## e.g. change the bathymetry colours
pg$scale_fill[[1]]$plotargs$colours <- topo.colors(21)
## plot it
pg
## If we want to change the legend breaks we can add breaks to the plotting arguments.
pg$scale_fill[[1]]$plotargs$breaks <- c(0,500,1000,4000)
## when the print or plot method is called on pg, it creates an actual ggplot2
## object, which we can capture and modify
pg_gg <- plot(pg)
class(pg_gg)
## modifying this is done in the same way any other ggplot object is modified
## e.g. add a new scale_fill_gradientn to override the existing one
pg_gg + ggplot2::scale_fill_gradientn(colours = heat.colors(21))
} # }