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,

output of boxplot

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

Popular posts from this blog

html - Sizing a high-res image (~8MB) to display entirely in a small div (circular, diameter 100px) -

java - IntelliJ - No such instance method -

identifier - Is it possible for an html5 document to have two ids? -