0
我[R腳本這是我的[R腳本:奇怪軸曲線與ggplot
#!/usr/bin/env Rscript
library (ggplot2)
data = read.table ("downloads.txt", header=T)
data$number = factor (data$Size)
data$PITtype = factor (data$PITtype)
g.all <- ggplot (data, aes (x=Time, y=number, color=PITtype)) +
geom_point (size=2) +
geom_line() +
ylab ("# Pending Downloads") +
theme_bw()
png ("pendingDownloads_graph.png", width=800, height=800)
print (g.all)
x = dev.off()
而這一組數據,我用:
Time PITtype Size
3 SimplePIT 60
6.25 SimplePIT 127
9.5 SimplePIT 197
12.75 SimplePIT 249
16 SimplePIT 319
19.25 SimplePIT 381
22.5 SimplePIT 459
25.75 SimplePIT 531
29 SimplePIT 594
32.25 SimplePIT 668
35.5 SimplePIT 723
38.75 SimplePIT 774
42 SimplePIT 851
45.25 SimplePIT 902
48.5 SimplePIT 959
51.75 SimplePIT 1020
55 SimplePIT 1092
58.25 SimplePIT 1167
61.5 SimplePIT 1223
64.75 SimplePIT 1283
68 SimplePIT 1337
71.25 SimplePIT 1420
74.5 SimplePIT 1515
77.75 SimplePIT 1607
81 SimplePIT 1662
84.25 SimplePIT 1728
87.5 SimplePIT 1792
90.75 SimplePIT 1854
94 SimplePIT 1931
我得到這個奇怪的圖(見'y'軸全部爲黑色)http://i40.tinypic.com/2dvivdf.png和此錯誤:geom_path:每個組只包含一個觀察值。你需要調整團體審美嗎?
這是怎麼回事?
因爲您已將'number'創建爲一個因子,並且每個數字都是唯一的,所以您獲得了與行數相同的因子。你想在這裏做什麼?爲什麼要創造一個因素 – Spacedman
我不知道使用R,我只覆蓋腳本。我只想知道尺寸如何及時增加。 – user2369478