scatter? in excel i just click and its there but i don't want to use excel and i'd like to script it... :)

2 views
Skip to first unread message

floutenvy

unread,
Jul 29, 2010, 9:02:45 PM7/29/10
to MadUseR
Hello,

i would like to create a scatter(plot) graph of data like the
following

num set1 set2 set3 set4 set5
1 1 2 3 4 5
2 6 7 8 9 10
3 11 113 13 14 15
4 16 17 18 19 20
5 21 104 23 24 25
6 26 27 44 29 30
7 31 32 33 34 35
8 36 37 38 39 40
9 41 42 43 28 45
10 46 47 48 49 50
11 51 52 53 54 55
12 56 57 58 59 60
13 61 62 63 64 65
14 66 67 68 69 70
15 71 72 73 74 75
16 76 77 78 79 80
17 81 82 83 84 85
18 86 87 88 89 90
19 91 92 93 94 95
20 96 97 98 99 100
21 101 102 103 22 105
22 106 107 108 109 110
23 111 112 12 114 115
24 116 117 118 119 120
25 121 122 123 124 125


In reality i will have 15 sets of data and the num column will go to
1000 (or more).

This should be easy but am unable to figure out how to do it. It would
be nice to have a text file read in and the graph saved out to an
image file... so that one could do many from a dos prompt (text file
created by perl script)

Any help would be much appriciated.

Brian Peterson

unread,
Aug 5, 2010, 4:03:03 PM8/5/10
to mad...@googlegroups.com
A scatter plot requires two axes:

plot(x,y)

it's not hard to script things in R to load lots of csv files and do something...

for ( file in list.files(filedir) )  # make a list of the files to load
{
    tmpcsv <- read.csv(paste(filedir,file,sep='')) # read the CSV file
    postscript(file=paste(file,".eps",sep=''), paper="special", horizontal=FALSE, onefile=FALSE)
    plot(tmpcsv[,1],tmpcsv[,2])
    dev.off()
}

Perhaps you could be more specific, and provide a reproducible example?
Reply all
Reply to author
Forward
0 new messages