Skip to content
Snippets Groups Projects
Commit 12109332 authored by Andreas Gattringer's avatar Andreas Gattringer
Browse files

plot_cats_run(): added legend title and specified plot function

parent c66d010d
No related branches found
No related tags found
No related merge requests found
......@@ -118,7 +118,7 @@ plot_cats_run <- function(results, catsconfig, run.name = NULL, replicate = 0) {
if (is.na(cc)) {
terra::plot(r, main = title)
} else {
terra::plot(r, range = c(0, cc), main = title)
terra::plot(r, range = c(0, cc), main = title, plg=list(title="Number of adults"))
}
last <- r
}
......@@ -137,7 +137,6 @@ plot_cats_run <- function(results, catsconfig, run.name = NULL, replicate = 0) {
x <- last - first
no_pop <- (last == 0 & first == 0)*1
no_pop <- terra::mask(x * 0, mask=no_pop, maskvalues=0) * 0
losses <-(x == -1)*1
......@@ -173,7 +172,7 @@ plot_cats_run <- function(results, catsconfig, run.name = NULL, replicate = 0) {
}
plot(populated ~ years, type="l", ylim=c(0, max_cells), main="Range size (cells)", xlab="Year", ylab="Cells")
base::plot(populated ~ years, type="l", ylim=c(0, max_cells), main="Range size (cells)", xlab="Year", ylab="Cells")
graphics::lines(populated_fit ~ years, col="blue")
graphics::lines(populated_unfit ~ years, col="red")
graphics::legend(x = min(years), y=max(populated/2), legend=c("Populated cells (all)", "Populated cells (fit)", "Populated cells (unfit)"), col=c("black", "blue", "red"), lty=1)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment