Skip to content

Commit 4cdee49

Browse files
committed
balebrun_plot grid updated; stereoplot's N is now a text at a specified position instead of mtext
1 parent 172c73e commit 4cdee49

14 files changed

Lines changed: 86 additions & 40 deletions

R/fabric_plots.R

Lines changed: 54 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -330,13 +330,13 @@ vollmer_plot.list <- function(x, labels = NULL, add = FALSE, ngrid = c(5, 5, 5),
330330
#' balebrun_plot(Pair_from_pitch(Plane(0, 80), 10), "strike-slip", col = 2, add = TRUE)
331331
#' balebrun_plot(Pair_from_pitch(Plane(0, 10), 10), "horizontal flow", col = 3, add = TRUE)
332332
balebrun_plot <- function(x, labels = NULL, main = "Dip-Pitch-Plunge Diagram", extra_labels = TRUE, add = FALSE, ...) {
333-
stopifnot(is.Pair(x))
334333
# plunge <- x[, "plunge"]
335-
pitch <- Pair_pitch(x)
336-
dip <- x[, "dip"]
337-
338-
crds <- .ternary_from_pitchdip(pitch, dip)
339-
334+
# pitch <- Pair_pitch(x)
335+
# dip <- x[, "dip"]
336+
#
337+
# crds <- .ternary_from_pitchdip(pitch, dip)
338+
crds <- .balebrun_coords(x)
339+
340340

341341
if (isFALSE(add)) {
342342
.ternary_plot(
@@ -380,6 +380,14 @@ balebrun_plot <- function(x, labels = NULL, main = "Dip-Pitch-Plunge Diagram", e
380380
invisible(crds)
381381
}
382382

383+
.balebrun_coords <- function(x){
384+
stopifnot(is.Pair(x))
385+
pitch <- Pair_pitch(x)
386+
dip <- x[, "dip"]
387+
.ternary_from_pitchdip(pitch, dip)
388+
}
389+
390+
383391
.ternary_from_pitchdip <- function(pitch, dip) {
384392
plunge <- plunge_from_pitchdip(pitch = pitch, dip = dip)
385393

@@ -424,13 +432,43 @@ balebrun_plot <- function(x, labels = NULL, main = "Dip-Pitch-Plunge Diagram", e
424432
}
425433

426434
# --- Constant pitch lines (pitch fixed, dip varies) ---
427-
dip_corner <- cbind(1, 0)
435+
# dip_corner <- cbind(1, 0)
436+
# pitch_seq_s <- sort(pitch_seq)
437+
# pitch_seq_sr <- pitch_seq_s[-c(1L, length(pitch_seq_s))] # remove first and last line
438+
#
439+
# pitch_lines_sr <- .ternary_from_pitchdip(pitch_seq_sr, dip = 90)
440+
# graphics::segments(x0 = dip_corner[, 1], y0 = dip_corner[, 2], x1 = pitch_lines_sr[, 1], y1 = pitch_lines_sr[, 2], col = col, lty = lty, ...)
441+
428442
pitch_seq_s <- sort(pitch_seq)
429443
pitch_seq_sr <- pitch_seq_s[-c(1L, length(pitch_seq_s))] # remove first and last line
430444

431-
pitch_lines_sr <- .ternary_from_pitchdip(pitch_seq_sr, dip = 90)
432-
graphics::segments(x0 = dip_corner[, 1], y0 = dip_corner[, 2], x1 = pitch_lines_sr[, 1], y1 = pitch_lines_sr[, 2], col = col, lty = lty, ...)
433-
445+
dip_seq2 <- seq(min(dip_seq), max(dip_seq), length.out = n_interp)
446+
dip_seq2 <- dip_seq2[-c(1L, length(dip_seq2))] # remove first and last line
447+
448+
invisible(lapply(pitch_seq_sr, function(p){
449+
pitch_lines_sr <- t(vapply(dip_seq2, function(d){
450+
pitch_lines_sr <- .ternary_from_pitchdip(p, dip = d)
451+
}, numeric(2)))
452+
graphics::lines(pitch_lines_sr[, 1], pitch_lines_sr[, 2], col = col, lty = lty)
453+
454+
})
455+
)
456+
457+
plunge_seq_s <- sort(plunge_seq)
458+
plunge_seq_sr <- plunge_seq_s[-c(1L, length(plunge_seq_s))] # remove first and last line
459+
460+
461+
invisible(lapply(pitch_seq, function(pl){
462+
crds <- t(vapply(pitch_seq, function(pi){
463+
di <- dip_from_pitchplunge(pi, pl)
464+
.ternary_from_pitchdip(pi, di)
465+
}, numeric(2))
466+
)
467+
lines(crds[, 1], crds[, 2], col = col, lty = lty)
468+
}))
469+
470+
471+
434472
# --- Constant plunge lines ---
435473
# plunge_seq_s <- sort(plunge_seq)
436474
# plunge_seq_sr <- plunge_seq_s[-c(1L, length(plunge_seq_s))] # remove first and last line
@@ -458,6 +496,12 @@ balebrun_plot <- function(x, labels = NULL, main = "Dip-Pitch-Plunge Diagram", e
458496

459497
graphics::text(dip_seq/90, 0, rev(dip_seq), pos = 1, cex = 0.8) # dip
460498
}
499+
500+
A <- c(0, 0) # left
501+
B <- c(1, 0) # right
502+
C <- c(1 / 2, sqrt(3) / 2) # top
503+
abc <- rbind(A, B, C)
504+
graphics::polygon(abc)
461505
}
462506

463507
#' Fabric Plot of Woodcock (1977)

R/stereonet_base.R

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -476,31 +476,31 @@ stereoplot_frame <- function(n = 512L, radius = 1, ...) {
476476
}
477477

478478

479-
#' Stereographic Projection
479+
#' Stereographic and Equal Area Projection
480480
#'
481-
#' Initialize the plot for equal-area stereographic projections (Wulff) or Lambert
482-
#' Equal-Area projections (Schmidt).
481+
#' Initialize the plot for equal-angle stereographic projections (Wulff) or Lambert
482+
#' equal-area projections (Schmidt).
483483
#'
484484
#' @param earea logical. Projection, either `TRUE` for Lambert equal-area
485485
#' projection (the default), or `FALSE` for meridional stereographic projection.
486486
#' @param guides logical. Whether guides should be added to the plot (`TRUE` by default)
487487
#' @param d integer. Angle distance between guides. Default: 10
488-
#' @param col color of guide lines
489-
#' @param lwd linewidth of guide lines
490-
#' @param lty linetype of guide lines
488+
#' @param col Color of guide lines
489+
#' @param lwd Width of guide lines
490+
#' @param lty Type of guide lines
491491
#' @param border.col color of primitive circle (frame), center-cross and ticks of the stereo plot
492492
#' @param centercross logical. Whether a center cross should be added (`TRUE` by default)
493493
#' @param ticks integer. Angle between ticks. if `NULL` (the default), no ticks are drawn.
494494
#' @param title,sub character. Title and subtitle of plot
495-
#' @param origin.text character. Text at origin of stereoplot.
495+
#' @param origin.text character. Text at origin of plot
496496
#' @param labels this can either be a logical value specifying whether (numerical)
497-
#' annotations are to be made next to the tickmarks, or a character or expression
498-
#' vector of labels to be placed next to the tickpoints.
499-
#' @param ladj adjustment for all labels away from origin of stereoplot circle.
497+
#' annotations are to be made next to the tick marks, or a character or expression
498+
#' vector of labels to be placed next to the tick points.
499+
#' @param ladj adjustment for all labels away from origin of projection circle.
500500
#' This essentially an amount that is added to `radius` and the length of the ticks.
501501
#' @param radius numeric. Radius of circle
502502
#' @param center An object of class `"Vec3"`, `"Line"`, `"Ray"`, or `"Plane"`
503-
#' specifying the center of the stereoplot. If `NULL` (the default), the center
503+
#' specifying the center of the projection If `NULL` (the default), the center
504504
#' is at the origin of the plot.
505505
#'
506506
#' @source Adapted from the `RFOC` package
@@ -526,13 +526,15 @@ stereoplot <- function(earea = TRUE, guides = TRUE, d = 10, col = "gray90",
526526
)
527527

528528
graphics::title(main = title, sub = sub)
529-
graphics::mtext(origin.text, col = border.col, font = 2)
529+
# graphics::mtext(origin.text, col = border.col, font = 2)
530+
531+
graphics::text(0, (3*ladj) + radius, label = "N", col = border.col, font = 2)
530532

531533
if (guides) stereoplot_guides(d = d, earea = earea, col = col, lwd = lwd, lty = lty, radius = radius, center = center)
532534

533535
if (!is.null(ticks)) stereoplot_ticks(angle = ticks, col = border.col, radius = radius, labels = labels, ladj = ladj)
534536

535-
if (centercross) points(0, 0, pch = 3, col = border.col)
537+
if (centercross) graphics::points(0, 0, pch = 3, col = border.col)
536538

537539
stereoplot_frame(col = border.col, radius = radius)
538540
}

man/figures/README-bestfit-1.png

6 Bytes
Loading

man/figures/README-defgrad1-1.png

0 Bytes
Loading

man/figures/README-stats-1.png

3 Bytes
Loading

man/figures/README-stereo-1.png

0 Bytes
Loading
0 Bytes
Loading
0 Bytes
Loading
0 Bytes
Loading
0 Bytes
Loading

0 commit comments

Comments
 (0)