Skip to content

Commit 01849e4

Browse files
committed
skip empty metadata columns in 2D plots
1 parent cef7831 commit 01849e4

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

workflow/scripts/plot_2d.R

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,12 @@ height_panel <- ceiling(ncol(metadata)/n_col) * height
5353
scatter_plots <- list()
5454

5555
for (col in colnames(metadata)){
56+
57+
# check if metadata column is only NA
58+
if(all(is.na(metadata[col]))){
59+
next
60+
}
61+
5662
tmp_data <- cbind(data, metadata[col])
5763
tmp_plot <- ggplot(tmp_data, aes_string(x=colnames(tmp_data)[1], y=colnames(tmp_data)[2])) +
5864
geom_point(aes_string(color=col), size=size, stroke=0, alpha=alpha) +

0 commit comments

Comments
 (0)