@@ -63,8 +63,9 @@ plot_MoranScatterplot <- function(
63
63
64
64
# # Validate input arguments; set variables -----------------------
65
65
.validate_class(object , c(" RLum.Results" , " numeric" , " integer" ))
66
- # # To add:
67
- # - should contain a numerical vector of length 100
66
+
67
+ if (inherits(object , " numeric" ) || inherits(object , " integer" ) )
68
+ .validate_length(object , 100 )
68
69
69
70
# # get ... arguments
70
71
plot_settings <- modifyList(
@@ -96,11 +97,14 @@ plot_MoranScatterplot <- function(
96
97
97
98
show_location_ids <- FALSE
98
99
show_n_neighbours <- FALSE
99
- if (plot_settings $ pch == " show_location_ids" )
100
+ if (plot_settings $ pch == " show_location_ids" ) {
100
101
show_location_ids <- TRUE
101
- else if (plot_settings $ pch == " show_n_neighbours" )
102
+
103
+ } else if (plot_settings $ pch == " show_n_neighbours" ) {
102
104
show_n_neighbours <- TRUE
103
105
106
+ }
107
+
104
108
vs_log <- plot_settings $ log # because we need the function "log" later
105
109
106
110
df_moran_plot <- data.frame (
@@ -196,14 +200,22 @@ plot_MoranScatterplot <- function(
196
200
plot_settings $ pch
197
201
}
198
202
199
- plot(df_moran_plot [,1 : 2 ],
200
- pch = vs_pch ,
201
- log = vs_log ,
202
- xlab = plot_settings $ xlab ,
203
- ylab = plot_settings $ ylab ,
204
- cex = plot_settings $ cex ,
205
- ...
206
- )
203
+ # # plot
204
+ # # remove used arguments to avoid collusion
205
+ args <- list (... )
206
+ args <- args [! ... names() %in% c(" pch" , " log" , " xlab" , " ylab" , " cex" , " legend" )]
207
+
208
+ do.call(
209
+ what = plot ,
210
+ args = c(
211
+ args ,
212
+ list (
213
+ df_moran_plot [,1 : 2 ],
214
+ pch = vs_pch ,
215
+ log = vs_log ,
216
+ xlab = plot_settings $ xlab ,
217
+ ylab = plot_settings $ ylab ,
218
+ cex = plot_settings $ cex )))
207
219
208
220
if (vs_points_appearance == " show_location_ids" ) {
209
221
text(x = df_moran_plot [,1 : 2 ],
@@ -268,3 +280,4 @@ plot_MoranScatterplot <- function(
268
280
269
281
invisible (df_moran_plot )
270
282
}
283
+
0 commit comments