简体   繁体   中英

Plot multiple obs. of 1 variables using ggplot2 in R

I a dataset whose matrix is delimited as follows multiple obs. of 1 variables multiple obs. of 1 variables :

>GC_percent
[1,] 0.4835822
[2,] 0.4782782
[...]
[5622,] 0.4968492
[5623,] 0.5076531

And I would draw a histogram with this one:

qplot(GC_percent, geom="histogram")

But inevitably it does not work:

Error: ggplot2 doesn't know how to deal with data of class matrix

As Roland said, ggplot2 needs a dataframe:

GC_percent <- as.data.frame(GC_percent)
qplot(GC_percent, geom="histogram")

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM