##################### ### Micro Note No. I on S-Plus Graphics ################### # There are some tools in S-Plus that are so called "High Level" graphics. # These just do some concrete job, like plot a histogram. z<-rnorm(1000) histogram(z) # This gives you a picture. It's OK this time, but in general # histograms are pretty lame --- they often conceal more than they reveal. # The reason for mentioning this function is to underscore that # behind the sceens, lives a more fundamental function named "plot". # Here is a plain-vanilla example of the plot function: x<-1:10 y<-x^2 plot(x,y) # Plot has lots of options you can explore. # Plot also lets you "keep doing stuff to it." # For example, lets put a vertical line at 5 and a hoizonal line at 25 abline(v=5) abline(h=10) # Or now, add some text a little to the upper right of (6,36) text(6.2, 36.3, "HERE") # Using more primatives like these you can bulid all sorts of plots, but this is more of # a presentation issue than an analysis issue. #Some more examples? xs=c(6,10) ys=c(36,100) lines(xs,ys) # Now you have almost everyting you need to know to draw the Mona Lisa in S-Plus # The only extra thing you need is a way to put down dots of varrying intensities or colors. # You should use help(plot) to explore some of the very many options. # Final point --- what stops one plot and starts another? # When you start a new plot --- or something call calls plot() --- you get a new plot. # Note, histogram and qqplot are "high level" tools that call plot --- and wipe out what you have in # your old plot. # You should also check out "devices" using help(devices). # This will show you how to save your plots to pdf or other kinds of files. # In windows we usually side step this just by doing cut-and-paste.