How to build very individual line styles with matplot in R

?parexplains what ltycan be specified as a vector of alternating long segments of extended / missing lines.

An example c(1,3,1,1)would look something like this:

─   ─ ─   ─ ─   ─ ─   ─ ─   ─ ─   ─ ─   ─ ─   ─ ─   ─ ─   ─ ─   ─ ─   ─ ─   ─ 

But if I try to pass lty=c(1,3,1,1)in matplot(or if I pre-install it with par), then matplotit assumes that I want to iterate over style 1 (solid), style 3 (dashed) style 1 (solid), style 1 (solid), which leads to this

────────────────────────────────────────────────────────────────────────────
─   ─   ─   ─   ─   ─   ─   ─   ─   ─   ─   ─   ─   ─   ─   ─   ─   ─   ─   
────────────────────────────────────────────────────────────────────────────
────────────────────────────────────────────────────────────────────────────
────────────────────────────────────────────────────────────────────────────
─   ─   ─   ─   ─   ─   ─   ─   ─   ─   ─   ─   ─   ─   ─   ─   ─   ─   ─   
────────────────────────────────────────────────────────────────────────────
────────────────────────────────────────────────────────────────────────────

instead of this

─   ─ ─   ─ ─   ─ ─   ─ ─   ─ ─   ─ ─   ─ ─   ─ ─   ─ ─   ─ ─   ─ ─   ─ ─   ─ 
─   ─ ─   ─ ─   ─ ─   ─ ─   ─ ─   ─ ─   ─ ─   ─ ─   ─ ─   ─ ─   ─ ─   ─ ─   ─ 
─   ─ ─   ─ ─   ─ ─   ─ ─   ─ ─   ─ ─   ─ ─   ─ ─   ─ ─   ─ ─   ─ ─   ─ ─   ─ 
─   ─ ─   ─ ─   ─ ─   ─ ─   ─ ─   ─ ─   ─ ─   ─ ─   ─ ─   ─ ─   ─ ─   ─ ─   ─ 
─   ─ ─   ─ ─   ─ ─   ─ ─   ─ ─   ─ ─   ─ ─   ─ ─   ─ ─   ─ ─   ─ ─   ─ ─   ─ 
─   ─ ─   ─ ─   ─ ─   ─ ─   ─ ─   ─ ─   ─ ─   ─ ─   ─ ─   ─ ─   ─ ─   ─ ─   ─ 
─   ─ ─   ─ ─   ─ ─   ─ ─   ─ ─   ─ ─   ─ ─   ─ ─   ─ ─   ─ ─   ─ ─   ─ ─   ─ 
─   ─ ─   ─ ─   ─ ─   ─ ─   ─ ─   ─ ─   ─ ─   ─ ─   ─ ─   ─ ─   ─ ─   ─ ─   ─ 

How can I make matplotit clear that he should interpret the whole vector as one style?

+4
source share
1 answer

, ?par , , , . "33".

, matplot , "" lty , .

matplot lty , . - lty = c("44","22","33","3322"). matplot, :

if (!add) {
        ii <- ii[-1L]
        plot(x[, 1L], y[, 1L], type = type[1L], xlab = xlab, 
            ylab = ylab, xlim = xlim, ylim = ylim, lty = lty[[1L]], 
            lwd = lwd[1L], lend = lend[1L], pch = pch[1L], col = col[1L], 
            cex = cex[1L], bg = bg[1L], ...)
    }
    for (i in ii) lines(x[, i], y[, i], type = type[i], lty = lty[[i]], 
        lwd = lwd[i], lend = lend[i], pch = pch[i], col = col[i], 
        cex = cex[i], bg = bg[i])

[ [[, lty. lty, .

+4

All Articles