Skip to content

Commit bc76dec

Browse files
Merge pull request #5 from FSchwendinger/dev
Implemented log option in es_plot_v2
2 parents a3cdf4f + bc2f4ef commit bc76dec

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

R/es_plot_v2.R

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ es_plot_v2 <- function(effect_size,
145145
area_arc = 0) {
146146

147147

148-
# Helper function to scale values linearly
148+
# Function that linearly scales values of x from range [min, max] to range [a, b]
149149
scale_lin <- function(x, a, b, min, max) {
150150
(((b - a) * (x - min)) / (max - min)) + a
151151
}
@@ -187,11 +187,8 @@ es_plot_v2 <- function(effect_size,
187187
# Limit must be positive
188188
limit <- abs(limit)
189189

190-
# Apply log transformation if needed
191-
if (eff_type == "log") {
192-
effect_size <- log(effect_size)
193-
ci_lower <- log(ci_lower)
194-
ci_upper <- log(ci_upper)
190+
# Because axis is on the log scale, transform limit to log scale too
191+
if (eff_type %in% "log") {
195192
limit <- log(limit)
196193
}
197194

@@ -470,5 +467,5 @@ es_plot_v2 <- function(effect_size,
470467
return(p)
471468
}
472469

473-
# es_plot_v2(0.9, 0.2, 2, eff_type = "log", area_arc = 0.95, limit = 20, num_labels = 3, palette = "RdYlGn")
470+
# es_plot_v2(effect_size = 0.9, 0.2, 2, eff_type = "log", area_arc = 0.95, limit = 20, num_labels = 3, palette = "RdYlGn")
474471

0 commit comments

Comments
 (0)