Re: [R] Additions to xyplot (lattice)? - legend, ticks, axis label size, text

2007-08-31 Thread Dave Hewitt
At 12:47 PM 8/30/2007 -0700, [EMAIL PROTECTED] wrote:
On 8/30/07, Dave Hewitt [EMAIL PROTECTED] wrote:
  Thank you very much... simple and easy fixes.
 
  Threefinal queries:
 
  (1) I need to make a little more room on the left for the larger axis
  label. I tried 'mex' in the list for ylab but that was ignored.

It's possible, but shouldn't be necessary. Can you provide a
reproducible example which shows why you need this?

I definitely can if needed, but... it's not that the axis label doesn't 
fit, it's just that I'd like a little more white space. So it may not match 
up with standard rules, but it's for a specific purpose. Please let me know 
how to adjust it.

Also, might this interact with my choice of plot size prior to production, 
with:

win.graph(width = 10, height = 7)


  (2) Is it possible to place a tick at each year on the x-axis, but only
  label every other year?

Not in those terms, but you can explicitly specify labels as

scales = list(x = list(at = c(1, 2, 3), labels = c(a, , c)))

etc.

So no ticks without labels, as specified by the user? The above generates 
only ticks with labels.


  (3) Can the legend pieces be broken into two lines (one for loess and one
  for points)?

Again, not in those terms, but you can fake it using

key = list(text = list(c(loess, points)),
lines = list(lwd = 2.5, col = c(gray, blue),
 cex = 1.25, pch = 19,
  type = c(p, l)))

Excellent. thanks.


-Deepayan

__
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
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Additions to xyplot (lattice)? - legend, ticks, axis label size, text

2007-08-31 Thread Deepayan Sarkar
On 8/31/07, Dave Hewitt [EMAIL PROTECTED] wrote:
 At 12:47 PM 8/30/2007 -0700, [EMAIL PROTECTED] wrote:
 On 8/30/07, Dave Hewitt [EMAIL PROTECTED] wrote:
   Thank you very much... simple and easy fixes.
  
   Threefinal queries:
  
   (1) I need to make a little more room on the left for the larger axis
   label. I tried 'mex' in the list for ylab but that was ignored.
 
 It's possible, but shouldn't be necessary. Can you provide a
 reproducible example which shows why you need this?

 I definitely can if needed, but... it's not that the axis label doesn't
 fit, it's just that I'd like a little more white space. So it may not match
 up with standard rules, but it's for a specific purpose. Please let me know
 how to adjust it.

Add something like

par.settings = list(layout.widths = list(ylab = 2))

 Also, might this interact with my choice of plot size prior to production,
 with:

 win.graph(width = 10, height = 7)

Do you want it to interact? I don't think width and height matter, but
pointsize (or whatever its equivalent for win.graph) might.

   (2) Is it possible to place a tick at each year on the x-axis, but only
   label every other year?
 
 Not in those terms, but you can explicitly specify labels as
 
 scales = list(x = list(at = c(1, 2, 3), labels = c(a, , c)))
 
 etc.

 So no ticks without labels, as specified by the user? The above generates
 only ticks with labels.

Yes, but the second label is blank (). Why is that not enough?

For finer control of tick marks and labels, you can specify a custom
function that computes these. See ?xscale.components.default, but this
is not very well documented and you will have to look into the sources
a bit.

-Deepayan

__
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
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Additions to xyplot (lattice)? - legend, ticks, axis label size, text

2007-08-31 Thread Dave Hewitt
I have a final Figure that looks terrific. Thanks Deepayan. Comments below.

At 01:35 PM 8/31/2007 -0700, Deepayan Sarkar wrote:
On 8/31/07, Dave Hewitt [EMAIL PROTECTED] wrote:
  At 12:47 PM 8/30/2007 -0700, [EMAIL PROTECTED] wrote:
  On 8/30/07, Dave Hewitt [EMAIL PROTECTED] wrote:
Thank you very much... simple and easy fixes.
   
Threefinal queries:
   
(1) I need to make a little more room on the left for the larger axis
label. I tried 'mex' in the list for ylab but that was ignored.
  
  It's possible, but shouldn't be necessary. Can you provide a
  reproducible example which shows why you need this?
 
  I definitely can if needed, but... it's not that the axis label doesn't
  fit, it's just that I'd like a little more white space. So it may not match
  up with standard rules, but it's for a specific purpose. Please let me know
  how to adjust it.

Add something like

par.settings = list(layout.widths = list(ylab = 2))

Excellent.


  Also, might this interact with my choice of plot size prior to production,
  with:
 
  win.graph(width = 10, height = 7)

Do you want it to interact? I don't think width and height matter, but
pointsize (or whatever its equivalent for win.graph) might.

I don't want it to [and wouldn't know why I would  :) ]. I just thought 
that might be a cause of the squishiness on the y-axis (though, again, the 
squishiness was just a personal preference thing).


(2) Is it possible to place a tick at each year on the x-axis, but only
label every other year?
  
  Not in those terms, but you can explicitly specify labels as
  
  scales = list(x = list(at = c(1, 2, 3), labels = c(a, , c)))
  
  etc.
 
  So no ticks without labels, as specified by the user? The above generates
  only ticks with labels.

Yes, but the second label is blank (). Why is that not enough?

Yep, duh. Sorry.


For finer control of tick marks and labels, you can specify a custom
function that computes these. See ?xscale.components.default, but this
is not very well documented and you will have to look into the sources
a bit.

Maybe later. :)


-Deepayan

__
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
and provide commented, minimal, self-contained, reproducible code.


[R] Additions to xyplot (lattice)? - legend, ticks, axis label size, text

2007-08-30 Thread Dave Hewitt
I have created an xyplot of a time series with the following code...

win.graph(width = 10, height = 7)

panel1 = function(x, y)  {
  panel.loess(x, y, lwd=2.5, span=0.5, col=gray)
  panel.xyplot(x, y, pch=19, col=blue, cex=1.25)
  }

xyplot(oneplusdensity ~ year, data=figdata, aspect=fill, cex=1.5,
  xlab=NULL, ylab=expression(Crabs per 1,000 m^2),
  xlim=c(1964, 2007), ylim=c(-2, 62),
  scales=list (x=list(tick.number=41, cex=0.8, rot=90),
  y= list(tick.number=7, cex=1.2)), panel=panel1)

I want to do the following things:

(1) Remove the ticks on the top and right boundaries
(2) Increase the size of the y-axis label to be larger than the tick labels
(3) Add a legend with the points and lowess line
(4) Add some annotation (text) in the lower left corner ('text' for plot() 
did not work)

I'm relatively new to lattice and spent a few hours with the manual and 
other help pages. I've begun to wonder if a regular old plot() for this 
would be better. Appreciate any redirection or suggestions.

Thanks,
Dave Hewitt

__
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
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Additions to xyplot (lattice)? - legend, ticks, axis label size, text

2007-08-30 Thread deepayan . sarkar
On 8/30/07, Dave Hewitt [EMAIL PROTECTED] wrote:
 I have created an xyplot of a time series with the following code...

 win.graph(width = 10, height = 7)

 panel1 = function(x, y)  {
   panel.loess(x, y, lwd=2.5, span=0.5, col=gray)
   panel.xyplot(x, y, pch=19, col=blue, cex=1.25)
   }

 xyplot(oneplusdensity ~ year, data=figdata, aspect=fill, cex=1.5,
   xlab=NULL, ylab=expression(Crabs per 1,000 m^2),
   xlim=c(1964, 2007), ylim=c(-2, 62),
   scales=list (x=list(tick.number=41, cex=0.8, rot=90),
   y= list(tick.number=7, cex=1.2)), panel=panel1)

 I want to do the following things:

 (1) Remove the ticks on the top and right boundaries

scales = list(tck = c(1, 0), x = ..., y = ...)

 (2) Increase the size of the y-axis label to be larger than the tick labels

ylab = list( expression(...), cex = 2)

 (3) Add a legend with the points and lowess line

See the entry for 'key' in ?xyplot. As a starting point,

key = list(text = list(loess), lines = list(lwd=2.5, span=0.5, col=gray),
   text = list(points), points = list(pch=19, col=blue, cex=1.25))

 (4) Add some annotation (text) in the lower left corner ('text' for plot()
 did not work)

Use panel.text() instead inside your panel function.

-Deepayan

 I'm relatively new to lattice and spent a few hours with the manual and
 other help pages. I've begun to wonder if a regular old plot() for this
 would be better. Appreciate any redirection or suggestions.

__
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
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Additions to xyplot (lattice)? - legend, ticks, axis label size, text

2007-08-30 Thread Dave Hewitt
Thank you very much... simple and easy fixes.

Threefinal queries:

(1) I need to make a little more room on the left for the larger axis 
label. I tried 'mex' in the list for ylab but that was ignored.

(2) Is it possible to place a tick at each year on the x-axis, but only 
label every other year?

(3) Can the legend pieces be broken into two lines (one for loess and one 
for points)?


At 11:12 AM 8/30/2007 -0700, [EMAIL PROTECTED] wrote:
On 8/30/07, Dave Hewitt [EMAIL PROTECTED] wrote:
  I have created an xyplot of a time series with the following code...
 
  win.graph(width = 10, height = 7)
 
  panel1 = function(x, y)  {
panel.loess(x, y, lwd=2.5, span=0.5, col=gray)
panel.xyplot(x, y, pch=19, col=blue, cex=1.25)
}
 
  xyplot(oneplusdensity ~ year, data=figdata, aspect=fill, cex=1.5,
xlab=NULL, ylab=expression(Crabs per 1,000 m^2),
xlim=c(1964, 2007), ylim=c(-2, 62),
scales=list (x=list(tick.number=41, cex=0.8, rot=90),
y= list(tick.number=7, cex=1.2)), panel=panel1)
 
  I want to do the following things:
 
  (1) Remove the ticks on the top and right boundaries

scales = list(tck = c(1, 0), x = ..., y = ...)

  (2) Increase the size of the y-axis label to be larger than the tick labels

ylab = list( expression(...), cex = 2)

  (3) Add a legend with the points and lowess line

See the entry for 'key' in ?xyplot. As a starting point,

key = list(text = list(loess), lines = list(lwd=2.5, span=0.5, col=gray),
text = list(points), points = list(pch=19, col=blue, 
 cex=1.25))

  (4) Add some annotation (text) in the lower left corner ('text' for plot()
  did not work)

Use panel.text() instead inside your panel function.

-Deepayan

  I'm relatively new to lattice and spent a few hours with the manual and
  other help pages. I've begun to wonder if a regular old plot() for this
  would be better. Appreciate any redirection or suggestions.

-
Dave Hewitt
Fisheries Science/Crustacean Ecology
Virginia Institute of Marine Science
College of William and Mary
P.O. Box 1346
Gloucester Point, VA  23062
804.684.7333
[EMAIL PROTECTED]
http://www.vims.edu/fish/students/dhewitt/

__
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
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Additions to xyplot (lattice)? - legend, ticks, axis label size, text

2007-08-30 Thread deepayan . sarkar
On 8/30/07, Dave Hewitt [EMAIL PROTECTED] wrote:
 Thank you very much... simple and easy fixes.

 Threefinal queries:

 (1) I need to make a little more room on the left for the larger axis
 label. I tried 'mex' in the list for ylab but that was ignored.

It's possible, but shouldn't be necessary. Can you provide a
reproducible example which shows why you need this?

 (2) Is it possible to place a tick at each year on the x-axis, but only
 label every other year?

Not in those terms, but you can explicitly specify labels as

scales = list(x = list(at = c(1, 2, 3), labels = c(a, , c)))

etc.

 (3) Can the legend pieces be broken into two lines (one for loess and one
 for points)?

Again, not in those terms, but you can fake it using

key = list(text = list(c(loess, points)),
   lines = list(lwd = 2.5, col = c(gray, blue),
cex = 1.25, pch = 19,
 type = c(p, l)))

-Deepayan

__
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
and provide commented, minimal, self-contained, reproducible code.