Re: [R] Spacing and margins in plot

2005-09-06 Thread Raubertas, Richard
You can do this with the 'mgp' argument to par()  (see ?par).
For example, I find par(mgp=c(2, 0.75, 0)) (which puts the
axis label on line 2 and the axis values on line 0.75) nicely
tightens up the space around a plot.

Rich Raubertas

 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf Of Earl F. Glynn
 Sent: Thursday, September 01, 2005 11:14 AM
 To: r-help@stat.math.ethz.ch
 Subject: Re: [R] Spacing and margins in plot
 
 
 Chris Wallace [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
 
  how about
  plot(..., xlab=)
  title(xlab=label text, line=2)
 
 Yes, Chris, I like your idea, especially when I can fix 
 both X and Y axes
 at the same time:
 
   plot(0, xlab=,ylab=)
   title(xlab=X axis, ylab=Y axis, line=2)
 
 I'd prefer a way to set the axis title line at the same time 
 I change the
 mar parameters, but it's not a big deal.
 
 Thanks.
 efg
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! 
 http://www.R-project.org/posting-guide.html
 
 


__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Spacing and margins in plot

2005-09-01 Thread Uwe Ligges
Jamieson Cobleigh wrote:

 If I use the following command to plot points:
 
 plot(c(1,2,2,3,3,3), type=p, pch=20, ylab=Y Label, xlab=X Label, 
 xaxt=n)
 
 there is a large amount of space between the label X Label and the
 actual x-axis.  If I change the xaxt=n to xaxt=s, the label X
 Label don't move at all.  Is there a way to get the label X Label
 closer to the x-axis when xaxt=n?
 
 
 
 The plot I am generating is going to be included in a paper I am
 writing.  I can cause the plot to be saved in a PDF file by doing the
 following:
 
 pdf(foo.pdf, width=5.5, height=4.25, onefile=FALSE)
 
 plot(c(1,2,2,3,3,3), type=p, pch=20, ylab=Y Label, xlab=X Label, 
 xaxt=n)
 
 dev.off();
 
 In the resulting file, there is a lot of whitespace around the graph,
 particularly between the top line of the plot area and the top of the
 page.  Since I am including these plots in a paper, I want them to be
 as large as possible and not take up any extra space.  Is there a way
 to get R to draw a plot that goes all the way to the margins of the
 print area?
 
 Jamie

For the size of margins see ?par and its argument mar, for the 
position of the x-axis label, add it in a separate call to title() and 
specify the line where to add the text as in:

   par(mar = c(1, 4, 0, 0) + 0.1)
   plot(c(1,2,2,3,3,3), type=p, pch=20, ylab=Y Label,
   xlab=, xaxt=n)
   title(xlab=X Label, line=0)


Uwe Ligges

 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Spacing and margins in plot

2005-09-01 Thread Earl F. Glynn
This technote explains the margin area (mar) and how to modify it to control
white space around a graphic:
http://research.stowers-institute.org/efg/R/Graphics/Basics/mar-oma/index.htm

When you have multiple figures on a graphic, you may also want to learn to
control the outer margin area (oma), which is also explained.

AFAIK, the only way to get the axis label closer to the axis is to
suppress the actual axis labels and use the mtext command to display
alternative text where you want it.  For example, look at the blue text in
Figure 2B (at the above link)  that is between the axis label and the axis.
This blue text is at line=2, when the axis labels are at line=3.

efg
Bioinformatics
Stowers Institute

Jamieson Cobleigh [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 If I use the following command to plot points:

 plot(c(1,2,2,3,3,3), type=p, pch=20, ylab=Y Label, xlab=X Label,
xaxt=n)

 there is a large amount of space between the label X Label and the
 actual x-axis.  If I change the xaxt=n to xaxt=s, the label X
 Label don't move at all.  Is there a way to get the label X Label
 closer to the x-axis when xaxt=n?

 The plot I am generating is going to be included in a paper I am
 writing.  I can cause the plot to be saved in a PDF file by doing the
 following:

 pdf(foo.pdf, width=5.5, height=4.25, onefile=FALSE)

 plot(c(1,2,2,3,3,3), type=p, pch=20, ylab=Y Label, xlab=X Label,
xaxt=n)

 dev.off();

 In the resulting file, there is a lot of whitespace around the graph,
 particularly between the top line of the plot area and the top of the
 page.  Since I am including these plots in a paper, I want them to be
 as large as possible and not take up any extra space.  Is there a way
 to get R to draw a plot that goes all the way to the margins of the
 print area?

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Spacing and margins in plot

2005-09-01 Thread Jamieson Cobleigh
That worked and gave me enough information so to make it look exactly
the way I want.

Thanks!

Jamie

On 9/1/05, Chuck Cleland [EMAIL PROTECTED] wrote:
 How about this:
 
 par(mar=c(2,4,1,1))
 
 plot(c(1,2,2,3,3,3), type=p, pch=20, ylab=Y Label, xlab=, xaxt=n)
 
 mtext(side=1, line=0.5, X Label)
 
 hope it helps,
 
 Chuck
 
 Jamieson Cobleigh wrote:
  If I use the following command to plot points:
 
  plot(c(1,2,2,3,3,3), type=p, pch=20, ylab=Y Label, xlab=X Label, 
  xaxt=n)
 
  there is a large amount of space between the label X Label and the
  actual x-axis.  If I change the xaxt=n to xaxt=s, the label X
  Label don't move at all.  Is there a way to get the label X Label
  closer to the x-axis when xaxt=n?
 
 
 
  The plot I am generating is going to be included in a paper I am
  writing.  I can cause the plot to be saved in a PDF file by doing the
  following:
 
  pdf(foo.pdf, width=5.5, height=4.25, onefile=FALSE)
 
  plot(c(1,2,2,3,3,3), type=p, pch=20, ylab=Y Label, xlab=X Label, 
  xaxt=n)
 
  dev.off();
 
  In the resulting file, there is a lot of whitespace around the graph,
  particularly between the top line of the plot area and the top of the
  page.  Since I am including these plots in a paper, I want them to be
  as large as possible and not take up any extra space.  Is there a way
  to get R to draw a plot that goes all the way to the margins of the
  print area?
 
  Jamie
 
  __
  R-help@stat.math.ethz.ch mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide! 
  http://www.R-project.org/posting-guide.html
 
 
 
 --
 Chuck Cleland, Ph.D.
 NDRI, Inc.
 71 West 23rd Street, 8th floor
 New York, NY 10010
 tel: (212) 845-4495 (Tu, Th)
 tel: (732) 452-1424 (M, W, F)
 fax: (917) 438-0894
 


__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Spacing and margins in plot

2005-09-01 Thread Chris Wallace
Earl F. Glynn [EMAIL PROTECTED] writes:

 AFAIK, the only way to get the axis label closer to the axis is to
 suppress the actual axis labels and use the mtext command to display
 alternative text where you want it.  For example, look at the blue text in
 Figure 2B (at the above link)  that is between the axis label and the axis.
 This blue text is at line=2, when the axis labels are at line=3.

how about
plot(..., xlab=)
title(xlab=label text, line=2)

?

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Spacing and margins in plot

2005-09-01 Thread Earl F. Glynn
Chris Wallace [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]

 how about
 plot(..., xlab=)
 title(xlab=label text, line=2)

Yes, Chris, I like your idea, especially when I can fix both X and Y axes
at the same time:

  plot(0, xlab=,ylab=)
  title(xlab=X axis, ylab=Y axis, line=2)

I'd prefer a way to set the axis title line at the same time I change the
mar parameters, but it's not a big deal.

Thanks.
efg

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html