I'm not an expert with the ggplot2 package. I have a subset selection problem.
Here is my code that produce this kind of graph...
g <- ggplot(merged_data,aes_string(x=Order,fill=var.y)) +
scale_y_continuous(expand = c(0.05,0)) +
xlab(paste("Order","Total number of sequences",sep=" - ")) +
ggtitle(main.str) +
geom_bar(position="fill",
subset = .(Order != ""),
width=0.6,hjust =0)+
geom_text(stat="bin",
subset = .(Order != ""),
color="black", hjust=1, vjust = 0.5, size=2,
aes_string(fill=NULL,x = Order,y = "0", label="..count.."))+
coord_flip()
For geom_bar and geom_text I select subset of data that remove empty names
subset = .(eval(parse(text=var.x)) != "")
this is a simple example with only 2 bars. Here is a the data ...
Collector<- c("BK","YE_LD","BK","JB","JB",
"BK","BK","BK","JB","YE_LD")
Order<-c("A","B","B","B","A",
"B","B","A","B","B")
data <- data.frame(Order,Collector)

Now I want to add a cutoff to my subset... only show the variable that that have a minimum of counts.
So if I put the cutoff = 4 ... I will get only the bar at the bottom that have 7 counts, the bar at the top with 3 counts should not appear.
I have no idea how I can do this ... Thanks for your help.
var.yandmain.str?