I Have data (expanded.plot.dat) that looks like this:
expanded UMAP_1 UMAP_2
a 339 -2.3 -5
b NA 0.4 2.7
c 3044 -1.2 4
d NA 3 -5.7
There are a lot of NA values and I would like them to be plotted, however the NA values are obscuring many of the non-NA values, I'm guessing this could be fixed by plotting NA values first.
The expanded column is a factor and I've tried converting it to numeric, sorting, and reverting it back to factor, I've also tried reordering the data in the ggplot object itself, but no matter what order I put the data ggplot seemingly plots independently of that order.
Thanks in advance for any assistance!
The ggplot line:
expanded.plot <- ggplot(expanded.plot.dat, aes(UMAP_1, UMAP_2, color=expanded)) + geom_point()
The output as it stands:
library(dplyr); expanded.plot <- ggplot(expanded.plot.dat %>% arrange(is.na(expanded)), ...
? I think that would put the FALSE (ie, not NA) first and the NA last. – Jon Spring