r - Multiple boxplots with ggplot2 in the same layer from a melted data frame with a condition -
i have data here [in .txt file] read data frame,
mydf <- read.table("data.txt", header=t,sep="\t") i melt data frame next using following piece of code,
df_mlt <-melt(mydf, id=names(mydf)[1], variable = "cols") now plot data boxplot displaying values of x>0 , use following code,
plt_bx <- ggplot(df_mlt, aes(x=id1,y=value>0, color=cols))+geom_boxplot() but resulting plot looks following,

however need display positive values of x individual box plots in same plot layer. please suggest need change in above code proper output, thanks.
plt_bx <- ggplot(subset(df_mlt, value > 0), aes(x=id1,y=value, color=cols)) + geom_boxplot() you need subset data frame remove undesirable values. right you're plotting value > 0, either true or false, instead of boxplot of values greater 0.
Comments
Post a Comment