SCATTER PLOTS
在2D作图中,为了体现位置数量特征我们有时候会使用点图(比如绘制SNP数量的时候)。本节将描述如何绘制点图
1、默认设置
scatter将被定义在plot板块,默认配置在 etc/tracks中 对于每一个plot板块,你可以指定type=scatter 对于一个不想定义的变量可以使用 stroke_color = undef
# etc/tracks/scatter.conf
glyph = circle
glyph_size = 10
color = grey
stroke_color = black
stroke_thickness = 0
r1 = 0.79r
r0 = 0.7r
orientation = out
基本语法:
所有的2D 数据轨道的设置几乎相同,对于scatter我们的设置方式是:
<plots>
<plot>
show = yes
type = scatter
file = data/6/snp.density.txt
r1 = 0.75r
r0 = 0.90r
max = 1.0
min = 0.0
glyph = rectangle
glyph_size = 8
color = red
stroke_color = dred
stroke_thickness = 1
</plot>
</plots>
下面解释一下参数含义:
- show - 与 highlights or links一样, 决定是否会展示
- type - 定义类型,参数有scatter, line, histogram, heatmap, etc.
- file - file that contains plot data
- min/max - the range of the plot axis, data outside this range are clipped
- r0/r1 - the inner and outer radius of the plot track, which may be formatted in absolute or relative (or mix) form, just like for highlights
- glyph - scatter的形状,可选参数有circle, rectangle, or triangle
- glyph_size - size of the glyph, in pixels
- color - if used, the the glyph will be solid and of this color
- stroke_color - if used, the glyph will have an outline of this color
- stroke_thickness - if used, the glyph's outline will have this thickness, in pixels
基本数据格式
chr start end value options
例子:
# value 0.005 at span 1000-2000 hs1 1000 2000 0.005 # value 0.010 at span 2001-2001, e.g. a single base position hs1 2001 2001 0.010
注意请注意,值与显式跨度相关联,而不是单个基对位置。 值不在绘图参数中定义的最小/最大范围之外的点未绘制。 您不需要编写规则来排除这些点。
绘制背景:
r0和r1参数定义曲线轨迹的径向开始和结束位置。 您可以选择使用
<backgrounds>
<background>
color = vvlgrey
</background>
</backgrounds>
通过定义几个background块,您可以对背景填充进行条带化和分层。 使用y0 / y1定义填充的径向范围。
<backgrounds>
<background>
color = vlgrey
# absolute fill range
y1 = 0.5
y0 = 0
</background>
<background>
color = vlred
# relative fill range
y1 = 1r
y0 = 0.75r
</background>
</backgrounds>
绘制径向刻度轴
上面的操作我们只是绘制了区域色块,我们还可以在径向上添加刻度
<axes>
<axis>
color = grey
thickness = 1
spacing = 0.05r
</axis>
</axes>
使用rule进行精确调控
如果我们已经对文本有一定的格式规范化,那么可以采用var函数来获取值
<rule>
condition = var(value) > 0.5
stroke_color = dgreen
color = green
glyph = rectangle
glyph_size = 6
</rule>
参考:2.1.4节 关于rule的使用 官网代码 here