Skip to content

Commit 751a0e2

Browse files
Fixed ggplot issue and bracket in comments
1 parent b6f7356 commit 751a0e2

File tree

9 files changed

+23
-15
lines changed

9 files changed

+23
-15
lines changed

DESCRIPTION

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ Description: Provides functions for making contour plots.
1111
process is fit to the data and used to create the contour plot.
1212
License: GPL-3
1313
RoxygenNote: 7.3.1
14+
Imports:
15+
rlang
1416
Suggests:
1517
knitr,
1618
rmarkdown,

NAMESPACE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,6 @@ importFrom(graphics,screen)
3535
importFrom(graphics,split.screen)
3636
importFrom(graphics,text)
3737
importFrom(graphics,title)
38+
importFrom(rlang,.data)
3839
importFrom(stats,predict)
3940
importFrom(utils,capture.output)

R/cf_grid_screen.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
#' @param nlevels if levels is not specified, the range of z, values is divided into approximately this many levels.
2222
#' @param color.palette A color palette function to be used to assign colors
2323
#' in the plot. Defaults to cm.colors.strong. Other options include rainbow,
24-
#' heat.colors, terrain.colors, topo.colors, and function(x) {gray((1:x)/x)}.
24+
#' heat.colors, terrain.colors, topo.colors, and function(x) \{gray((1:x)/x)\}.
2525
#' @param col an explicit set of colors to be used in the plot. This argument overrides any palette function specification. There should be one less color than levels
2626
#' @param plot.title statements which add titles to the main plot.
2727
#' @param plot.axes statements which draw axes (and a box) on the main plot. This overrides the default axes.
@@ -64,7 +64,7 @@
6464
#' r <- sqrt(outer(x^2, y^2, "+"))
6565
#' cf_grid(cos(r^2)*exp(-r/(2*pi)))
6666
#' cf_grid(r, color.palette=heat.colors, bar=TRUE)
67-
#' cf_grid(r, color.palette=function(x) {gray((1:x)/x)}, bar=TRUE)
67+
#' cf_grid(r, color.palette=function(x) \{gray((1:x)/x)\}, bar=TRUE)
6868
#' @references
6969
#' [1] filled.contour R function, copied function but removed part for sidebar
7070
#' @references

R/cf_highdim.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
#' consecutive levels are painted with the same color.
3030
#' @param color.palette A color palette function to be used to assign colors
3131
#' in the plot. Defaults to cm.colors.strong. Other options include rainbow,
32-
#' heat.colors, terrain.colors, topo.colors, and function(x) {gray((1:x)/x)}.
32+
#' heat.colors, terrain.colors, topo.colors, and function(x) \{gray((1:x)/x)\}.
3333
#' @param col an explicit set of colors to be used in the plot.
3434
#' This argument overrides any palette function specification.
3535
#' There should be one less color than levels.

R/gcf_grid.R

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
#' divided into approximately this many levels.
2323
#' @param color.palette a color palette function to be used to assign colors
2424
#' in the plot. Defaults to cm.colors. Other options include rainbow,
25-
#' heat.colors, terrain.colors, topo.colors, and function(x) {gray((1:x)/x)}.
25+
#' heat.colors, terrain.colors, topo.colors, and function(x) \{gray((1:x)/x)\}.
2626
#' @param col an explicit set of colors to be used in the plot. This argument
2727
#' overrides any palette function specification. There should be one less
2828
#' color than levels
@@ -48,6 +48,7 @@
4848
#'
4949
#' @return ggplot2 object
5050
#' @export
51+
#' @importFrom rlang .data
5152
#'
5253
#' @examples
5354
#' x <- y <- seq(-4*pi, 4*pi, len = 27)
@@ -105,20 +106,23 @@ gcf_grid <- function (x = seq(0, 1, length.out = nrow(z)),
105106
# scale_fill_gradientn(colours=c("cyan","white","magenta"))
106107
ggplot2::scale_fill_gradientn(colours=col)
107108
if (!lines_only) {
108-
p <- p + ggplot2::geom_raster(ggplot2::aes_string(x="Var1", y="Var2", fill = "tz"),
109-
t2, interpolate=interpolate)
109+
p <- p + ggplot2::geom_raster(ggplot2::aes(x=.data$Var1, y=.data$Var2,
110+
fill = .data$tz),
111+
t2, interpolate=interpolate)
110112
}
111113

112114
# Add contour lines
113115
if (with_lines) {
114-
p <- p + ggplot2::geom_contour(ggplot2::aes_string(x="Var1", y="Var2", z = "tz"),
116+
p <- p + ggplot2::geom_contour(ggplot2::aes(x=.data$Var1, y=.data$Var2,
117+
z = .data$tz),
115118
bins=bins,
116119
color="black",
117120
t2)
118121
}
119122
if (lines_only) { # Only color lines if only lines
120-
p <- p + ggplot2::geom_contour(ggplot2::aes_string(x="Var1", y="Var2", z = "tz",
121-
color="..level.."),
123+
p <- p + ggplot2::geom_contour(ggplot2::aes(x=.data$Var1, y=.data$Var2,
124+
z = .data$tz,
125+
color=.data$..level..),
122126
bins=bins,
123127
t2)
124128
}
@@ -174,7 +178,7 @@ gcf_grid <- function (x = seq(0, 1, length.out = nrow(z)),
174178
# points(pts, pch=19)
175179
pts <- as.data.frame(pts)
176180
colnames(pts) <- c("V1", "V2")
177-
p <- p + ggplot2::geom_point(ggplot2::aes_string("V1","V2"), data=pts)
181+
p <- p + ggplot2::geom_point(ggplot2::aes(.data$V1, .data$V2), data=pts)
178182
}
179183

180184
if (!is.null(afterplotfunc)) {

cran-comments.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
I added new functions and new functionality.
1+
I received an email that I need to fix the note on CRAN by 8/27/24.
2+
Apologies for slightly missing that deadline.
23

34
## Test environments
45
* local Windows 7 install, R 3.6.0

man/cf_grid.Rd

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

man/cf_highdim.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/gcf_grid.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)