ggplot2 - R - getting discrete variable to be treated as continous - more difficulty -
i'm facing same issue on post - how discrete factor levels treated continuous?
i've tried converting variable factor numeric didn't work. graph still displayed in discrete format.
require(ggplot2) library(reshape2) m <- 10 n <- 6 nam <- list(c(),letters[1:n]) var <- as.data.frame(matrix(sort(rnorm(m*n)),m,n,f,nam)) dtf <- data.frame(t=seq(m)*0.1, var) mdf <- melt(dtf, id=c('t')) xs <- c(0.25,0.5,1.0,2.0,4.0,8.0) levels(mdf$variable) <- xs class(mdf$variable) mdf$variable <- as.numeric(as.character(mdf$variable)) g <- ggplot(mdf,aes(variable,value,group=variable,colour=t)) g + geom_point() + scale_x_continuous() what doing wrong?

i've discovered needed - in order visualize graph in more line fashion needed use geom_smooth(se=f) instead of geom_point()
Comments
Post a Comment