Add annotation color bar to ggplot
1
0
Entering edit mode
da.de ▴ 20
@dade-7723
Last seen 10 months ago
Austria

Hi,

I want to add annotation color to a normal ggplots2 figure (barplot) like it is used for example in pheatmap.

pheatmap(assay(ntd)[select,], cluster_rows=FALSE, show_rownames=FALSE, cluster_cols=FALSE, annotation_col=df)

For a pheatmap I add a df for annoation_col.
How can I do it for other figures?

Thanks for your help, best Dagmar

 

ggplot2 annotation • 1.0k views
ADD COMMENT
0
Entering edit mode
TriS ▴ 200
@tris-5635
Last seen 14 months ago
United States

how do your data look?

good examples are posted here 

generally you have a data.frame that looks like

library(ggplot2)
d <- data.frame(value=sample(1:100,20),
                names=rep(c("a","b","c","d"),each=5),
                groups=rep(c("fancy","non-fancy"),each=10))

and then you can plot coloring/annotating based on group

ggplot(d, aes(x=names,y=value,fill=groups)) + geom_bar(stat="identity")

 

 

 

ADD COMMENT
0
Entering edit mode

I have a bar plot with 150 samples of different groups. Some of them are negative. If I color the bars I do not see the difference between the groups, that's why I wanted to add the annotation like it is used in pheatmap. Just to show that all groups are represented equally

ADD REPLY

Login before adding your answer.

Traffic: 487 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6