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

node_colour_by does not colour nodes #131

Open
RiboRings opened this issue Jun 19, 2024 · 8 comments
Open

node_colour_by does not colour nodes #131

RiboRings opened this issue Jun 19, 2024 · 8 comments
Assignees
Labels
bug Something isn't working

Comments

@RiboRings
Copy link
Member

Hi!

I think the node_colour_by arg of plotRowTree shows an unexpected behaviour. For example the following code generates an image without colours:

library(miaViz)
library(mia)
data("Tengeler2020", package = "mia")
tse <- Tengeler2020
plotRowTree(tse, node_colour_by = "Class")

Screenshot 2024-06-19 at 16 19 43

@RiboRings RiboRings added the bug Something isn't working label Jun 19, 2024
@antagomir
Copy link
Member

In what way you think it is unexpected?

@RiboRings
Copy link
Member Author

Not sure, shouldn't the edges be coloured by Class?

@antagomir
Copy link
Member

Ah, yes. @ElySeraidarian do you see anything here?

@ElySeraidarian
Copy link
Contributor

I will check this.

@ElySeraidarian
Copy link
Contributor

ElySeraidarian commented Jun 20, 2024

It seems that there is indeed an issue as it considers nodes as NA values
plot_out <- .resolve_plot_colours(plot_out, plot_out$data$colour_by, colour_by, fill = point_out$fill, na.translate = FALSE, na.value = "red")
Here by adding na.value = "red", it actually changes the plot like that :
image

I have not been able to solve the issue yet but I'm working on it.

@antagomir
Copy link
Member

@ElySeraidarian any updates on this one?

@ElySeraidarian
Copy link
Contributor

I have not been able to solve the problem yet even though I can see where it happens but can't understand why.

tip_point_FUN <- geom_tippoint

library(miaViz)
library(mia)
data("Tengeler2020", package = "mia")
tse <- Tengeler2020
plotRowTree(tse, node_colour_by = "Class")

Here if we add a print statement of the plot after adding nodes in the if statement, here's what we get :
image

Whereas, plotRowTree(tse, tip_colour_by = "Class") will get this figure.
image.
I am still unsure how it gets the labels for the legend when plotting with tip_colour_by, it should be stored in plot_out$data$colour_by but this is only used after in .plot_resolve_colours()

I will still give a try but have been quite unsuccessful so far

@antagomir
Copy link
Member

Right, tips correspond to the final ends end nodes also to the intermediate branch points.

For many current purposes the tip_colour_by should be enough. The names for that come from rowData directly? (each tip (and node) associates with one rowData row).

Could you update the examples so that they show how this can be done for the tips?

Are the links between nodes and rowData rows available? (rowLinks)? Missing links might explain the issue. If links are missing, little can be done afterwards, those links should be added already when the rowTree is integrated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants