Skip to content

Commit 6a48d2b

Browse files
committed
Support named colors, aspect ratio
1 parent 018c623 commit 6a48d2b

12 files changed

Lines changed: 103 additions & 460 deletions

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,4 @@ VignetteBuilder:
2626
knitr
2727
Encoding: UTF-8
2828
Language: en-US
29-
RoxygenNote: 7.3.2
29+
RoxygenNote: 7.3.3

NEWS.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66

77
* Fix the checking for multiple cell values when there are 2 panel factors.
88

9+
* New support for `aspect` with `ggdesplot()`. (P.Schmidt)
10+
11+
* New support for named colors (P.Schmidt).
912

1013
# desplot 1.10 (2023-03-01)
1114

PR_description.md

Lines changed: 0 additions & 87 deletions
This file was deleted.

R/desplot.R

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,6 @@ RedGrayBlue <- colorRampPalette(c("firebrick", "lightgray", "#375997"))
6464
#' To correctly outline the split-plot factor, simply concatenate the
6565
#' whole-plot factor and sub-plot factor together.
6666
#'
67-
#' To get a map of a field with a true aspect ratio (lattice version only),
68-
#' include 'aspect=ylen/xlen'
69-
#' in the call, where 'ylen' is the vertical length of the field and 'xlen'
70-
#' is the horizontal length of the field.
71-
#'
7267
#' To call this function inside another function, you can hack like this:
7368
#' vr <- "yield"; vx <- "x"; vy <- "y";
7469
#' eval(parse(text=paste("desplot(", vr, "~", vx, "*", vy, ", data=yates.oats)")))
@@ -153,6 +148,13 @@ RedGrayBlue <- colorRampPalette(c("firebrick", "lightgray", "#375997"))
153148
#' @param cex Expansion factor for text/number in each cell.
154149
#'
155150
#' @param strip.cex Strip cex.
151+
#'
152+
#' @param aspect Aspect ratio.
153+
#' To get a map of a field with a true aspect ratio include 'aspect=ylen/xlen'.
154+
#' For lattice, 'ylen' is the vertical length of the field and 'xlen'
155+
#' is the horizontal length of the field.
156+
#' For ggplot2, 'ylen' is the vertical length of each cell/plot and 'xlen'
157+
#' is the horizontal length of each plot.
156158
#'
157159
#' @param subset An expression that evaluates to logical index vector for subsetting the data.
158160
#'
@@ -189,11 +191,18 @@ RedGrayBlue <- colorRampPalette(c("firebrick", "lightgray", "#375997"))
189191
#' d1 <- update(d1, par.settings = list(layout.heights=list(strip=2)))
190192
#' print(d1)
191193
#'
192-
#' # Show experiment layout
193194
#' data(yates.oats)
195+
#' # Show experiment layout in true aspect
196+
#' # Field width = 4 plots * 44 links = 176 links
197+
#' # Field length = 18 plots * 28.4 links = 511 links
198+
#' # With lattice, the aspect ratio is y/x for the entire field
194199
#' desplot(yates.oats,
195200
#' yield ~ col+row,
196-
#' out1=block, out2=gen)
201+
#' out1=block, out2=gen, aspect=511/176)
202+
#' # With ggplot, the aspect ratio is y/x for each cell
203+
#' ggdesplot(yates.oats,
204+
#' yield ~ col+row,
205+
#' out1=block, out2=gen, aspect=28.4/44)
197206
#'
198207
#' desplot(yates.oats,
199208
#' block ~ col+row,
@@ -219,7 +228,8 @@ desplot <- function(data,
219228
show.key=TRUE,
220229
key.cex, # left legend cex
221230
cex=.4, # cell cex
222-
strip.cex=.75,
231+
strip.cex=.75,
232+
aspect=NULL,
223233
subset=TRUE, gg=FALSE, ...){
224234

225235
# Would be nice to remove this code someday, maybe 2022?

man/desplot.Rd

Lines changed: 18 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

reprex_aspect.R

Lines changed: 0 additions & 41 deletions
This file was deleted.

test_aspect.R

Lines changed: 0 additions & 76 deletions
This file was deleted.

0 commit comments

Comments
 (0)