Commit 16c64024 authored by Romulo Pereira Goncalves's avatar Romulo Pereira Goncalves
Browse files

Allow inline plotting and plotting on the the browser. For Jupyter notebooks...

Allow inline plotting and plotting on the the browser. For Jupyter notebooks we recommend inline plotting.
parent 3dbf1cf5
......@@ -154,7 +154,6 @@ multi_Class_Sampling <- function(in.raster,
new.acc <- list()
decision = "0"
##########################################################################
while (decision == "0") {
for (rs in 1:multiTest) {
########################
......@@ -233,21 +232,50 @@ multi_Class_Sampling <- function(in.raster,
new.names[[rs]] <- index
new.acc[[rs]] <- acc
if (rs == multiTest) {
if (plot_on_browser == TRUE) {
if (.Platform$OS.type == "unix") {
grDevices::x11()
} else {
grDevices::windows()
}
attach(mtcars)
if (multiTest < 4) {
par(mfrow = c(multiTest, 1))
} else {
par(mfrow = c(round(multiTest/4), multiTest %% 4))
}
}
par(mar = c(2, 2, 2, 3), mfrow = n2mfrow(multiTest))
for (rr in 1:length(test)) {
if (plot_on_browser == FALSE) {
png(file = paste(outPath, 'multi_', rr, '.png', sep = ""), width = 600, height = 500, res = 72)
}
plot(
test[[rr]],
col = col(200),
main = "",
legend.shrink = 1)
mtext(side = 3,
paste(rr, classNames[new.names[[rr]]], sep = " "),
paste('Test ', rr, '- class ', classNames[new.names[[rr]]], sep = " "),
font = 2)
if (plot_on_browser == FALSE) {
dev.off()
IRdisplay::display_png(file = paste(outPath, 'multi_', rr, '.png', sep = ""))
}
}
}
}
decision <-
readline("Which distribution is acceptable or sample again (0) [.. or 0]: ")
if (plot_on_browser == FALSE) {
for (rr in 1:length(test)) {
fn <- paste(outPath, 'multi_', rr, '.png', sep = "")
if (file.exists(fn)) {
#Delete file if it exists
file.remove(fn)
}
}
}
}
maFo_rf <- maFo[[as.numeric(decision)]]
index <- new.names[[as.numeric(decision)]]
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment