Skip to content

Commit

Permalink
skip empty metadata columns in 2D plots
Browse files Browse the repository at this point in the history
  • Loading branch information
sreichl committed Sep 9, 2022
1 parent cef7831 commit 01849e4
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions workflow/scripts/plot_2d.R
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@ height_panel <- ceiling(ncol(metadata)/n_col) * height
scatter_plots <- list()

for (col in colnames(metadata)){

# check if metadata column is only NA
if(all(is.na(metadata[col]))){
next
}

tmp_data <- cbind(data, metadata[col])
tmp_plot <- ggplot(tmp_data, aes_string(x=colnames(tmp_data)[1], y=colnames(tmp_data)[2])) +
geom_point(aes_string(color=col), size=size, stroke=0, alpha=alpha) +
Expand Down

0 comments on commit 01849e4

Please sign in to comment.