Skip to content

Instantly share code, notes, and snippets.

@Swarchal
Last active September 27, 2019 22:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Swarchal/53104181a30c2bb6b62d to your computer and use it in GitHub Desktop.
Save Swarchal/53104181a30c2bb6b62d to your computer and use it in GitHub Desktop.
heatmap.R
library(ggplot2)
library(reshape2)
df_expression <- read.csv("expression.csv")
df_molten <- melt(df_expression)
ggplot(data = df_molten,
aes(x = variable, y = MouseID, fill = value)) +
geom_raster() +
xlab("Protein") +
scale_fill_distiller(palette = "RdYlBu", trans = "log10") +
theme(axis.text.x = element_text(angle = 90, hjust = 1),
axis.text.y = element_blank()) +
ggtitle("ggplot heatmap")
@Rubel005
Copy link

Hi, Thanks for the nice sharing of the heatmap generation. I am reproducing your commands using my own datasets and found the output. In your heatmap, in the y-axis (mouse id), you did not show all labeling of mouse id [(e.g., axis.text.y = element_blank())]. would you please improve this section for how to show all samples id in y-axes . Thanks ....

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