how can scatterplot drawn dataframe in r?
b c d 5 0 0 0 0 7 9 0
the plot should in such way 1 axis label should a b c d
(the column names) , other axis should labelled 0 20.
you may try this:
the data needs formatted slightly. use melt
reshape2
package convert data below format.
library(reshape2) data = melt(data, measure.vars = c("a","b","c","d"))
now data
looks :
> data variable value 1 5 2 0 3 b 0 4 b 7 5 c 0 6 c 9 7 d 0 8 d 0
plotting: using ggplot
, in effort mirror pic...
library(ggplot2) ggplot(data, aes(x=variable, y = value)) + geom_point(shape = 3)
output
Comments
Post a Comment