r - How to plot values in a matrix -
suppose have matrix this:
trainingsize trainingtime accuracy [1,] 1179 0.923 0.262 [2,] 2356 0.953 0.563 [3,] 3536 0.971 0.869 [4,] 4712 0.979 1.212 [5,] 5889 0.983 1.542
how can plot trainingsize vs accuracy , trainingtime vs accuracy in 2 dimensional space?
qplot(lcmatrix[,1], lcmatrix[,3]) qplot(lcmatrix[,2], lcmatrix[,3])
these 2 commands plot separately. how plot them together?
does work?
qplot(lcmatrix[,1], lcmatrix[,3]) + qplot(lcmatrix[,2], lcmatrix[,3])
converting comment ..
here's way plot trainingsize vs accuracy , trainingtime vs accuracy in 1 plot:
require(ggplot2) require(reshape2) ggplot(melt(as.data.frame(m), id="accuracy"), aes(x = accuracy, y = value, color = variable)) + geom_point()
so convert matrix data.frame , melt resulting data.frame id = "accuracy"
afterwards can plotted in 1 plot.
r plot ggplot2
No comments:
Post a Comment