I have a load of genomic data as follows
chr leftPos V
1 1232 122
1 3232 443
1 43534 13
3 12 12
3 234234 432
4 1222 155
5 4324 124
5 345345 75
5 456457 83
I would like to plot this data as a barplot organised by chr so that all the bars for chr1 are shown then chr2 etc exactly as per the dataframe
All I've managed so far is:
ggplot(TBB_2)+
geom_bar(aes(TBB_2$leftPos, TBB_2$V),stat="identity", fill="red",group="chr")
but I get the error
Warning messages:
1: Stacking not well defined when ymin != 0
2: position_stack requires constant width: output may be incorrect
EDIT
So I tried an alternative method which is to organise as a facet plot so that each facet represents a chr, but nothing is being plotted and I don't know why not:
ggplot(TBB_2)+
geom_bar(aes(x = TBB_2$leftPos,y = as.numeric(TBB_2$V)),stat="identity")+
facet_wrap(~ chr)