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

Color x-axis labels of heatmap generated by heatmaply #243

Open
shalawa opened this issue Jun 3, 2020 · 4 comments
Open

Color x-axis labels of heatmap generated by heatmaply #243

shalawa opened this issue Jun 3, 2020 · 4 comments

Comments

@shalawa
Copy link

shalawa commented Jun 3, 2020

How do I color the x-axis labels of a heatmap generated from heatmaply?
Example:
heatmaply( mtcars)
I want vs, am, carb, and wt to be colored in red and drat, gear, cyl, qsec, mpg, hp and disp to be colored in blue (attached)
heatmap_mtcars

@alanocallaghan
Copy link
Collaborator

Sorry, it looks like varying tick text colour isn't possible in plotly at the moment. See the example code:

library("plotly")

## Works
plot_ly(mtcars) %>% add_markers(~cyl, ~gear) %>%
    layout(
        xaxis=list(
            tickvals = c(4, 6, 8),
            tickfont=list(color = c("#7ea6f8"
            #, "#a6f87e", "#a0f684"
            ))
        )
    )

## Doesn't work
plot_ly(mtcars) %>% add_markers(~cyl, ~gear) %>%
    layout(
        xaxis=list(
            tickvals = c(4, 6, 8),
            tickfont=list(color = c("#7ea6f8", "#a6f87e", "#a0f684"))
        )
    )

I'll leave this open in case it becomes possible in future but I don't have the bandwidth to try to make the upstream changes at the moment.

You could possibly accomplish some of the same effect using dendrogram colouring if that's useful?

@shalawa
Copy link
Author

shalawa commented Jun 3, 2020

Dear Alan,

Thank you so much for your reply.
I ran the code you supplied above.
I'm not sure this is the output I'm trying to produce.
I'm attaching another an image of the output I'm trying to generate just to make sure that I expressed the issue clearly.
In the new attached figure, you can find that the x axis labels are colored.
Is this also not possible at the moment?
heatmap_mtcars - Copy

@alanocallaghan
Copy link
Collaborator

That is correct, I believe that is not possible.

The point of the code I posted was to demonstrate (mainly for myself if I come back to this later) that it's not possible to set different tick text colour in plotly in general. Using a basic plot makes this easier than trying to modify heatmaply to test whether it is possible

@shalawa
Copy link
Author

shalawa commented Jun 3, 2020

Ah ok. Thank you so much for your clarification

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

No branches or pull requests

2 participants