Skip to content

Commit 252a171

Browse files
committed
warn user when incorrect labels are specified
earlier code provided incomprehensible information to the user. Behaviour of point.attr now updated to match changes to plot code, when input has no information on labels.
1 parent f753bb0 commit 252a171

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

R/plot_calls.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ circleplot<-function(
6666
point.attr<-function(distance.matrix)
6767
{
6868
if(length(attr(distance.matrix, "Labels"))==0){
69-
attr(distance.matrix, "Labels")<-c(1:attr(distance.matrix, "Size"))}
69+
attr(distance.matrix, "Labels")<-paste("V", c(1:attr(distance.matrix, "Size")), sep="")}
7070
labels<-as.character(attr(distance.matrix, "Labels"))
7171
color.hex<-c(RColorBrewer::brewer.pal(8, "Dark2"),
7272
brewer.pal(9, "Set1"),

R/prep_objects.R

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,12 +182,17 @@ set.plot.attributes<-function(
182182
if(is.null(plot.defaults$par)){plot.defaults$par<-par.default}
183183

184184
# 3. points
185+
matrix.labels<-lapply(input$wide, colnames)[[1]]
185186
if(is.null(plot.defaults$points)){ # | reduce
186187
n.points<-lapply(input$wide, ncol)[[1]] #ncol(input$wide)
187-
label.vals<-lapply(input$wide, colnames)[[1]]
188+
label.vals<-matrix.labels
188189
}else{
189190
n.points<-nrow(plot.defaults$points)
190-
label.vals<-plot.defaults$points$labels}
191+
label.vals<-plot.defaults$points$labels
192+
# check these match
193+
if(all(sort(matrix.labels)==sort(label.vals))==FALSE){
194+
stop("supplied point labels do not match those from the input matrix or data.frame")}
195+
}
191196
# generate a 'null' data.frame
192197
point.defaults<-data.frame(
193198
labels= label.vals,

0 commit comments

Comments
 (0)