Skip to content

Commit

Permalink
ideas on automating paneled approach to sketching large SPCs
Browse files Browse the repository at this point in the history
  • Loading branch information
dylanbeaudette committed Oct 13, 2023
1 parent 646e057 commit 09560b0
Showing 1 changed file with 51 additions and 0 deletions.
51 changes: 51 additions & 0 deletions misc/sandbox/auto-panel-sketches.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
library(soilDB)
library(aqp)

x <- fetchNASIS()

x <- HzDepthLogicSubset(x)

sdc <- getSoilDepthClass(x)
site(x) <- sdc

z <- subset(x, depth > 40)
z <- subset(z, !is.na(soil_color))

z$texcl <- factor(z$texcl, levels = SoilTextureLevels())

# z <- combine(lapply(1:216, random_profile, SPC = TRUE))



# suggestions for even numbers
.s <- 1:length(z)
.fidx <- which(length(z) %% .s == 0)
.s[.fidx]


.size <- 72
z$.chunk <- makeChunks(seq_along(z), size = .size)
.chunkIds <- unique(z$.chunk)
.n <- length(.chunkIds)

## TODO: this doesn't work for thematic sketches, as each panel gets its own legend

par(mar = c(0, 0, 0, 2), mfrow = c(.n, 1))

for(i in .chunkIds) {
.idx <- which(z$.chunk == i)
plotSPC(
z[.idx, ],
print.id = FALSE,
name = NA,
lwd = 0.1,
divide.hz = FALSE,
width = 0.4,
max.depth = 110,
depth.axis = list(line = -4, cex = 1),
n = .size,
# color = 'texcl'
# color = 'p1'
)
}

0 comments on commit 09560b0

Please sign in to comment.