Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with coloring DPT plot #15

Open
SmritiChawla opened this issue Jan 29, 2019 · 1 comment
Open

Issue with coloring DPT plot #15

SmritiChawla opened this issue Jan 29, 2019 · 1 comment

Comments

@SmritiChawla
Copy link

SmritiChawla commented Jan 29, 2019

Hi

I am trying to add colors to dpt plot ( 6 colors ) but it is not showing those colors. It is taking some other colors. I am trying to use this command

color_data <- c(
  rep("yellow",92),
  rep("Red",102),
  rep("green",66),
  rep("blue",172),
  rep("black",138),
  rep("magenta",188)
)
p <- plot.DPT(dpt, col = as.vector(color_data))

But these colors are not reflected.
I will be grateful if you resolve this issue. Thank your for consideration

Regards
Smriti

@flying-sheep
Copy link
Collaborator

flying-sheep commented Jan 30, 2019

works perfectly for me:

grafik

by the way, I very much suggest you

  1. don’t use named colors as a color palette (no red, green, …) but instead something like colorbrewer.

  2. don’t use a color vector like this. instead, use a factor or integer vector like this:

    cluster_labels <- # an integer of length n_cells
    plot(dpt, col = cluster_labels, palette = brewer.pal(length(unique(cluster_labels)), 'Set1'))
    # or this
    palette(brewer.pal(9, 'Set1'))
    plot(dpt, col = cluster_labels)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants