在基本的R图形中,是否可以找到添加矩形的确切位置? [英] In base R graphics, is it possible to find exact placing of the added rectangles?

查看:127
本文介绍了在基本的R图形中,是否可以找到添加矩形的确切位置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

关于试图复制复杂图形I,继续阅读此问题我正在使用托马斯'

挖掘我发现了一个添加选项例如:

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

然而 - 必须选择上限和下限(耐心;)主要是通过试验和错误。



有没有办法添加一些automa

解决方案

建立您的解决方案:

 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)


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?

解决方案

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)

这篇关于在基本的R图形中,是否可以找到添加矩形的确切位置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆