From: Deepayan Sarkar <deepayan.sarkar_at_gmail.com>

Date: Sat 20 Aug 2005 - 14:58:11 EST

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 Received on Sat Aug 20 15:11:42 2005

Date: Sat 20 Aug 2005 - 14:58:11 EST

On 8/19/05, Maciej Kalisiak <mkalisiak@gmail.com> wrote:

> I tend to prefer doing graphics in R using the lattice library. I'm

*> "porting" some old scripts. Is there a nice way to get in lattice the
**> equivalent of the plot(type='h'), which is the high-density
**> lines/histogram plot in base graphics package? I tried doing this
**> with barchart(), but with limited success... the fact that I have
**> ~1000 datapoints/bars causes problems, in that R insists on rendering
**> a tick/label for each bar,
*

Yes, all (or most, at least) lattice functions will do that if the variable is a factor or shingle (which barchart forces).

> and as far as I can tell the plot doesn't

*> come out as accurate, due to running together of the bars (at least in
**> plot(type='h') you are guaranteed that each bar/line is exactly one
**> pixel wide)...
*

Your best bet is to coerce to numeric, and use xyplot, whose default panel function honors type='h'. e.g.

xyplot(yield ~ as.numeric(variety) | site + year,

data = barley, type = 'h')

or for horizontal bars,

xyplot(as.numeric(variety) ~ yield | site + year,

data = barley, type = 'h', horizontal = TRUE)

Had too many labels not been a problem, you could also have used

barchart(as.numeric(variety) ~ yield | site + year,

data = barley, panel = panel.xyplot, type = 'h')

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 Received on Sat Aug 20 15:11:42 2005

*
This archive was generated by hypermail 2.1.8
: Fri 03 Mar 2006 - 03:39:55 EST
*