Skip to content

Commit

Permalink
Bug fix in plot()
Browse files Browse the repository at this point in the history
Bug fix in plot()
  • Loading branch information
mingdeyu committed Jan 21, 2025
1 parent 16501d5 commit 7abcecf
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
20 changes: 10 additions & 10 deletions R/plot.R
Original file line number Diff line number Diff line change
Expand Up @@ -1247,13 +1247,13 @@ plot_style_1 <- function(dat, method, dim, isdup) {
if ( method=="sampling" ){
p <- p +
ggplot2::geom_pointrange(data=dat[!dup,], ggplot2::aes_(x=~idx, y=~median, ymin=~lower, ymax=~upper, color = "Median and 95% CI"), fatten = 1.5, size = 0.3) +
ggplot2::scale_color_manual(name = "", values = c("Median and 95% CI"="#52854C", "Validation point outside CI"="#D55E00", "Validation point inside CI"="#E69F00"),
limits = c("Median and 95% CI", "Validation point outside CI", "Validation point inside CI"))
ggplot2::scale_color_manual(name = "", values = c("Median and 95% CI"="#52854C", "Validation point inside CI"="#E69F00"),
limits = c("Median and 95% CI", "Validation point inside CI"))
} else if ( method=="mean_var" ) {
p <- p +
ggplot2::geom_pointrange(data=dat[!dup,], ggplot2::aes_(x=~idx, y=~mean, ymin=~lower, ymax=~upper, color = "Mean and CI (+/-2SD)"), fatten = 1.5, size = 0.3) +
ggplot2::scale_color_manual(name = "", values = c("Mean and CI (+/-2SD)"="#52854C", "Validation point outside CI"="#D55E00", "Validation point inside CI"="#E69F00"),
limits = c("Mean and CI (+/-2SD)", "Validation point outside CI", "Validation point inside CI"))
ggplot2::scale_color_manual(name = "", values = c("Mean and CI (+/-2SD)"="#52854C", "Validation point inside CI"="#E69F00"),
limits = c("Mean and CI (+/-2SD)", "Validation point inside CI"))
}

p <- p +
Expand All @@ -1264,19 +1264,19 @@ plot_style_1 <- function(dat, method, dim, isdup) {
legend.text = ggplot2::element_text(size = 7),
legend.title = ggplot2::element_blank()
) +
ggplot2::guides(colour = ggplot2::guide_legend(override.aes = list(linetype = c("solid", "blank", "blank"))))
ggplot2::guides(colour = ggplot2::guide_legend(override.aes = list(linetype = c("solid", "blank"))))
} else if ( all(!coverage) ){
p <- ggplot2::ggplot(dat, ggplot2::aes_(x=~idx, y=~y_validate, color = "Validation point outside CI"))
if ( method=="sampling" ){
p <- p +
ggplot2::geom_pointrange(data=dat[!dup,], ggplot2::aes_(x=~idx, y=~median, ymin=~lower, ymax=~upper, color = "Median and 95% CI"), fatten = 1.5, size = 0.3) +
ggplot2::scale_color_manual(name = "", values = c("Median and 95% CI"="#52854C", "Validation point outside CI"="#D55E00", "Validation point inside CI"="#E69F00"),
limits = c("Median and 95% CI", "Validation point outside CI", "Validation point inside CI"))
ggplot2::scale_color_manual(name = "", values = c("Median and 95% CI"="#52854C", "Validation point outside CI"="#D55E00"),
limits = c("Median and 95% CI", "Validation point outside CI"))
} else if ( method=="mean_var" ) {
p <- p +
ggplot2::geom_pointrange(data=dat[!dup,], ggplot2::aes_(x=~idx, y=~mean, ymin=~lower, ymax=~upper, color = "Mean and CI (+/-2SD)"), fatten = 1.5, size = 0.3) +
ggplot2::scale_color_manual(name = "", values = c("Mean and CI (+/-2SD)"="#52854C", "Validation point outside CI"="#D55E00", "Validation point inside CI"="#E69F00"),
limits = c("Mean and CI (+/-2SD)", "Validation point outside CI", "Validation point inside CI"))
ggplot2::scale_color_manual(name = "", values = c("Mean and CI (+/-2SD)"="#52854C", "Validation point outside CI"="#D55E00"),
limits = c("Mean and CI (+/-2SD)", "Validation point outside CI"))
}

p <- p +
Expand All @@ -1287,7 +1287,7 @@ plot_style_1 <- function(dat, method, dim, isdup) {
legend.text = ggplot2::element_text(size = 7),
legend.title = ggplot2::element_blank()
) +
ggplot2::guides(colour = ggplot2::guide_legend(override.aes = list(linetype = c("solid", "blank", "blank"))))
ggplot2::guides(colour = ggplot2::guide_legend(override.aes = list(linetype = c("solid", "blank"))))
} else {
p <- ggplot2::ggplot(dat, ggplot2::aes_(x=~idx, y=~y_validate, color = ~coverage))
if ( method=="sampling" ){
Expand Down
5 changes: 4 additions & 1 deletion inst/WORDLIST
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ CMD
Challenor
DGP
DGPs
EI
ESS
GPs
Gu
Guillas
Heteroskedastic
Katzfuss
LHD
MacKay
Expand All @@ -19,6 +19,7 @@ NRMSEs
OOS
RStudio
Scalable
Shubert
Technometrics
UUID
VIGF
Expand All @@ -29,6 +30,7 @@ arXiv
bool
bools
burnin
conda
doi
et
ggplots
Expand All @@ -39,6 +41,7 @@ lifecycle
maximin
oos
reproducibility
repurpose
scalable
softmax
suboptimal
Expand Down

0 comments on commit 7abcecf

Please sign in to comment.