简体   繁体   English

基本 plot 在 R 中使用 ggplot2

[英]Basic plot using ggplot2 in R

I have a data frame t1 as follows:我有一个数据框t1如下:

   V1    V2
1  1 83.60687
2  2 83.90725
3  3 84.03346
4  4 85.89171

I want to plot V2 vs V1 by using ggplot but unable to do it:我想通过使用 ggplot 来 plot V2 vs V1 但无法做到:

library(ggplot2)
ggplot(data = t1, aes(x = V1, y = V2)) + 
geom_point()

It gives me an error saying:它给了我一个错误说:

Error in readRDS(nsInfoFilePath): error reading from connection In addition: Warning message: In readRDS(nsInfoFilePath): error reading the file readRDS(nsInfoFilePath) 中的错误:从连接中读取错误另外:警告消息:在 readRDS(nsInfoFilePath) 中:读取文件时出错

How can I plot my data points?我怎样才能 plot 我的数据点? Thanks in advance.提前致谢。

The following works correctly -- I suspect you have a problem unrelated to plotting.以下工作正常 - 我怀疑你有一个与绘图无关的问题。

V1 = c(1,2,3,4)
V2 = c(83,84,85,86)

t1=data.frame(V1,V2)

library(ggplot2)
ggplot(data = t1, aes(x = V1, y = V2)) + 
  geom_point()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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