stephenslab / ebnm

R package to fit Empirical Bayes Normal Means model.
https://stephenslab.github.io/ebnm/
12 stars 9 forks source link

Colors in plot() #101

Closed pcarbo closed 1 year ago

pcarbo commented 1 year ago

The colors in plot() are very poor constrast; not sure how you chose them. I suggest using the colorbrewer2.org colors, e.g.,

color_brewer <- c("#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#ffff33","#a65628","#f781bf","#999999")
plot(fit1,fit2) +
  scale_color_manual(values = color_brewer)

My comment applies to both types of plots that can be generated by plot.

willwerscheid commented 1 year ago

they were chosen using scale_color_brewer(type = "qual"). do you suggest a different palette?

willwerscheid commented 1 year ago

i think i must not be seeing what you're seeing because the colors look pretty good to me. could you include a reproducible example?

pcarbo commented 1 year ago

Sure, here's the basic plot (top) and the plot with colorbrewer2 colors (bottom):

Screen Shot 2023-07-06 at 10 23 12 AM

This is my code:

color_brewer <- c("#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00",
                  "#ffff33","#a65628","#f781bf","#999999")
p1 <- plot(fit_normal,fit_unimodal,fit_npmle)
p2 <- plot(fit_normal,fit_unimodal,fit_npmle) +
  scale_color_manual(values = color_brewer)
plot_grid(p1,p2,nrow = 2,ncol = 1)
pcarbo commented 1 year ago

These are the 9 colors.

willwerscheid commented 1 year ago

Ok, your link is to palette Set1. I am currently using palette Accent (the default for type = "qual"). I do not have a strong preference. If you prefer Set1 that would be fine with me.

willwerscheid commented 1 year ago

fyi you can get those colors via scale_color_brewer(palette = "Set1"). You do not need to manually provide the hex codes

pcarbo commented 1 year ago

Great! I did not know that.