[R] lattice: How to display no box but only a y-axis on the left + Thicker lines

Deepayan Sarkar deepayan.sarkar at gmail.com
Wed Sep 30 08:23:28 CEST 2009


On Fri, Sep 18, 2009 at 6:06 AM, baptiste auguie
<baptiste.auguie at googlemail.com> wrote:
> No box is easy,
>
> bwplot(y~x, data=data.frame(y=rnorm(10),x=sample(letters[1:3],10,repl=T)),
> par.settings=list(axis.line=list(col=NA)))
>
> but that seems to remove all axis lines and ticks as well. You may
> have to define a custom panel.axis() function.

Yes. You can get back the tick marks with scaless$col:

bwplot(y~x, data=data.frame(y=rnorm(10),x=sample(letters[1:3],10,repl=T)),
      par.settings=list(axis.line=list(col=NA)), scales = list(col = 1))

but lattice's default axis function doesn't draw the axis in the same
way as base's axis().

-Deepayan

> An alternative is to use grid.remove() to remove the frame,
> bwplot(y~x, data=data.frame(y=rnorm(10),x=sample(letters[1:3],10,repl=T)))
> grid.remove("rect",grep=T,global=TRUE)
>
> HTH,
>
> baptiste
>
>
>
> 2009/9/18 lith <minilith at gmail.com>:
>>> 1.) How do I make lattice (e.g. barchart) to not draw a box but only a
>>> y-axis on the left hand side so that the plot looks like barplot with
>>> default settings?
>>
>> Does nobody have an idea? Or is the solution that obvious?
>>
>> ______________________________________________
>> R-help at r-project.org 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-help at r-project.org 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.
>




More information about the R-help mailing list