[R] Remove the border/frame in a dotplot()

Duncan Mackay dulcalma at bigpond.com
Tue Dec 2 00:44:50 CET 2014


Hi 

See also 
https://stat.ethz.ch/pipermail/r-help/2007-September/140098.html

This may do

library(grid)

dotplot(~ 1:10, scales = list(col = "black", tck = c(1, 0)),
       par.settings = list(axis.line = list(col = "transparent")),
       axis = function(side, ...) {
           if (side == "left")
                grid.lines(x = c(0, 0), y = c(0, 1),  default.units = "npc")
           else if (side == "bottom")
                grid.lines(x = c(0, 1), y = c(0, 0),   default.units = "npc")
           axis.default(side = side, ...)
       })

Duncan

Duncan Mackay
Department of Agronomy and Soil Science
University of New England
Armidale NSW 2351
Email: home: mackay at northnet.com.au


-----Original Message-----
From: R-help [mailto:r-help-bounces at r-project.org] On Behalf Of Richard M. Heiberger
Sent: Monday, 1 December 2014 03:01
To: stéphanie braun
Cc: r-help at r-project.org
Subject: Re: [R] Remove the border/frame in a dotplot()

stéphanie,

I believe you need all of this.  Look at it with a good editor and in
a monowidth font such
as courier to see the structure.

Rich

library(lattice)
library(latticeExtra)
dotplot(~ 1:10,
        par.settings=list(
          axis.line=list(col="transparent"),
          clip=list(panel=FALSE))) +
            layer({panel.axis(side="bottom", line.col="black", outside=TRUE);
                   panel.abline(h=current.panel.limits()$ylim[1],
                                v=current.panel.limits()$xlim[1])})

On Sat, Nov 29, 2014 at 4:59 PM, stéphanie braun <r-help at r-project.org> wrote:
> Dear listmembersI wouldlike to remove in a dotplot() the border/frame from the figure and only keepthe x- and y-axis. I can’t find a way to do this. bty="n" does notwork. Can somebody help? I include the r coding for my figure below. dotplot(plant_species ~ mean, data =botany,            aspect= 1.5,            scales=list(x=list(tck=c(-1,0)),y = list(tck=c(-1,0))),            ylab= "Plant species",            xlim= c(-1.1, 1.1),            xlab= "Electivity index",prepanel = NULL,            panel= function (x, y) {            panel.abline(v=0)            panel.xyplot(x,y, pch = 16, col = "black")            panel.segments(botany$lower,as.numeric(y),            botany$upper,as.numeric(y), lty = 1, col = "black")}
>
> Thank you!Stéphanie
>
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> 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