Changing parameters when using plotCI in R. (left or right shift points)

I know that you can move boxes to the left or right on the chart by adding "at = 1: 6-0,2" or "at = 1: 6 + 0,2" to the code, but this is not the case when I I use plotCI. Does anyone know how to do this simple parameter setting? I know this should be easy, but there are very few questions about plotCI. It is in the {gplots} package. It drives me crazy! Thanks for any help. For -Alex-

+3
source share
3 answers

If you want to move everything (points and error bars), then you need to add a small amount to the x plotCI parameter:

plotCI(x=myx+0.2,y=...)

, , , , , ? , , plotCI, - offset -, plotCI.

plotCI , . plotCI , - , plotCI_offset. , x myarrow if/else, .

def :

plotCI_offset <- function (x, y = NULL, uiw, liw = uiw, ui, li, err = "y", ylim = NULL, 
xlim = NULL, type = "p", col = par("col"), barcol = col, 
pt.bg = par("bg"), sfrac = 0.01, gap = 1, lwd = par("lwd"), 
lty = par("lty"), labels = FALSE, add = FALSE, xlab, ylab, 
minbar, maxbar,offset=0.2, ...) 

:

if (!add) {
    if (invalid(labels) || labels == FALSE)
        #Add offset here to ensure plot window is right size
        plot(x+offset, y, ylim = ylim, xlim = xlim, col = col, xlab = xlab, 
            ylab = ylab, ...)
    else {
        plot(x, y, ylim = ylim, xlim = xlim, col = col, type = "n", 
            xlab = xlab, ylab = ylab, ...)
        text(x, y, label = labels, col = col, ...)
    }
}

, , :

if (err == "y") {
    if (gap != FALSE) 
        gap <- strheight("O") * gap
    smidge <- par("fin")[1] * sfrac
    if (!is.null(li))
        #Add offset to CIs 
        myarrows(x+offset, li, x+offset, pmax(y - gap, li), col = barcol, 
            lwd = lwd, lty = lty, angle = 90, length = smidge, 
            code = 1)
    if (!is.null(ui)) 
        myarrows(x+offset, ui, x+offset, pmin(y + gap, ui), col = barcol, 
            lwd = lwd, lty = lty, angle = 90, length = smidge, 
            code = 1)
}

, . .

+2

:

require(plotrix)
plotCI(1:3-0.1, m1, ui1, li1, xlab="Itens", ylab="Eta2",axes=FALSE)
axis(side=1,at=1:9,label=c(x1,x2,x3),padj=0,las=1)
axis(side=2)

, :

plotCI(1:3+.1,m2, ui2, li2,axes=FALSE,col="blue",add=TRUE)

......

+1

I have a hack for this: you do not move your data, but move the labels along the axes !

eg. you want to move your data points to the right by 1 on the x axis, you hide the x axis and redraw it with new labels:

plotCI(..., axes=F) # just ignore the warning
axis(side=1, at=0:99, labels=1,100)
0
source

All Articles