OK ... now that I can see an example I have a couple of suggestions:

1. First of all, design your "framing" first. How big do you want the
plot to be? Do you want portrait or landscape? Are you importing your
plots into a Word document, etc.? Most of the R plotting I do is for
incorporation into Word documents. As a result, I make them the right
size for plotting two landscape-format plots per page -- any smaller and
they're unreadable. So ... take an 8x11 (US) or A4 (or whatever)
portrait page, subtract out the margins and divide it into an upper and
a lower chunk. That gives you the "width" and "height" parameters for
whatever file type you're making (png, pdg, wmf for Windows R, etc.)

2. Now, write your script and produce *all* the graphs you're going to
make, letting R pick all the defaults. Include in this script any
"main", "sub", "xlab" and "ylab" titles you want on the resulting plots;
this step is to see what R is going to do to them. :) If you have
pre-defined scaling, code it in this step. For example, I do a lot of
plots of CPU utilization, and to compare different experiments, I always
plot CPU utilization from zero to 100 percent, rather than letting R
pick it. In other cases, I'll be comparing something else, like I/O
operations per second. In an instance like that, I'll plot all of them
with R making the choices, then pick the largest of the Y axis maxima
and re-plot them all with ylim=c(0, ymax).

3. Now, look at the plots you made. For example, the example you posted
has numbers on the Y axis colliding with what looks like the "ylab"
value. There are three things you can do to make this plot look better:

   a. You've plotted current in mA (milliamps?). In your plot statement,
multiply by 0.001 and change the label to microamps (don't ask me how to
get the "mu" character :).

   b. Rotate the x and y axis labels by 90 degrees. You can do this with
"las=2" in your "par" call.

   c. Shrink *all* the type on the plots. You can do this with "cex=0.7"
in your "par" call. I haven't used values less than 0.7; the characters
are way too small.

Marcus D. Hanwell wrote:

>On Saturday 11 June 2005 23:21, Timothy H. Keitt wrote:
>  
>
>>You can get publication quality plots from R with a bit of wrestling.
>>I've had good luck with it for quite complicated plots. First do
>>'help(par)' and read carefully. The 'xlim' and 'ylim' parameters usually
>>work fine -- I've not seen values outside the given range. Can you post
>>your plot command? Also check out the 'lattice' package. There are some
>>R - graphics guides on the web that may help.
>>
>>    
>>
>My plot command is as follows,
>
>plot(test[[1]],test[[3]],type="l",xlab="Time (s)", ylab="Current (mA)", 
>col="black", las=1, xlim=c(30,1000))
>
>It still decides to show 0 and a little below, and then 1000 and a little 
>above. May be there is some setting to tighten up the axes? Also need to 
>display the axes labels more concisely using scientific notation. I have put 
>a problem plot on the web so you can see the results,
>
>http://dev.gentoo.org/~cryos/test.png
>
>You can see the incorrectly scaled axes - I want it to begin at dead on 0, or 
>may be 30 as I tried there but it doesn't seem to want to listen to me... I 
>do need to get it to produce some graphs with a small overlaid graph, and may 
>be some 2x2 graphs which both seem possible as far as I can tell.
>
>I have found http://cran.r-project.org/doc/contrib/ which seems to have some 
>great docs in it. I am checking out usingR-2.pdf right now but haven't found 
>the answers to all my questions yet. These docs seem much better than the 
>previous stuff I found.
>
>Thanks,
>
>Marcus
>  
>
-- 
[email protected] mailing list

Reply via email to