In base R graphics, is it possible to find exact p

2019-07-16 11:32发布

Following up this question on an attempt to reproduce the complex graph I am working with Thomas' solution.

All works exactly as specified but I was wondering if there is an option to add transparent grey shading to alternate 'rows' of the graph, similarly as it is done in the original version provided by OP.

Digging around I've found an option to add transparent rectangle covering specified area, for instance:

rect(-10, 2.8, 12, 3.3, col="#00000025", border=NA)

However - the upper and lower limits have to be chosen (with patience ;) largely by trial and error.

Is there a way to add some automation to this process?

1条回答
SAY GOODBYE
2楼-- · 2019-07-16 11:58

Building on your solution:

shaded_rowseq <- rowseq[rep(c(T,F),length(rowseq)/2)]
rect(-10, shaded_rowseq-0.5, 12, shaded_rowseq+0.5, col="#00000025", border=NA)
查看更多
登录 后发表回答