我正在尝试创建散点图,然后在散点图中的点之间添加线条。我可以使用import csv
with open('C:/Users/User/OneDrive/Documents/Price.csv','r') as csvinput:
with open('C:/Users/User/OneDrive/Documents/Date.csv', 'w') as csvoutput:
writer = csv.writer(csvoutput, lineterminator='\n')
reader = csv.reader(csvinput)
all = []
row = next(reader)
for row in reader:
row.append(row[1])
all.append(row)
writer.writerows(all)
和plot
来实现此功能,如下所示:
segments
我想实现相同类型的想法,但使用ggplot2。我的理由是,我可能想在情节中添加美学,而ggplot2允许这超过set.seed(10)
xvar = runif(10, 0, 1)
yvar = runif(10, 0, 1)
start = c(1, 1, 1, 9)
end = c(2, 4, 6, 10)
plot(xvar, yvar)
segments(xvar[start], yvar[start], xvar[end],yvar[end], col= 'blue')
。我尝试了以下的变体:
plot
但无济于事。任何指针都非常感谢!