Question: Add annotation color bar to ggplot
0
gravatar for da.de
18 months ago by
da.de10
Austria
da.de10 wrote:

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

 

annotation ggplot2 • 523 views
ADD COMMENTlink modified 18 months ago by TriS200 • written 18 months ago by da.de10
Answer: Add annotation color bar to ggplot
0
gravatar for TriS
18 months ago by
TriS200
United States
TriS200 wrote:

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 COMMENTlink written 18 months ago by TriS200

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 REPLYlink written 18 months ago by da.de10
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 16.09
Traffic: 223 users visited in the last hour