我做了一个这样的情节:
plot(
layer(x=sort(randn(1000),1), y=sort(randn(1000),1), Geom.point),
layer(x=[-4,4], y=[-4,4], Geom.line(), Theme(default_color=color("black"))))
Run Code Online (Sandbox Code Playgroud)
如您所见,点周围的白色圆圈使得图中的高密度部分几乎为白色.
我想将点的外圆颜色更改为黑色(或蓝色),以更好地显示这些点确实存在.
从牛虻文档看起来像highlight_color
的说法Theme()
可能做到这一点,但它需要一个函数作为参数.
我不明白这是怎么回事.有任何想法吗?
论证名称原来是discrete_highlight_color
......
它应该是修改用于绘图的颜色的函数,通常通过使其更亮("浅色")或更暗("阴影").在我们的例子中,我们可以忽略当前的颜色并返回黑色.
using Color
using Gadfly
plot(
layer(
x = sort(randn(1000),1),
y = sort(randn(1000),1),
Geom.point,
# Theme(highlight_width=0.0mm) # To remove the border
Theme( discrete_highlight_color = u -> LCHab(0,0,0) )
),
layer(
x = [-4,4],
y = [-4,4],
Geom.line(),
Theme(default_color=color("black"))
)
)
Run Code Online (Sandbox Code Playgroud)
为了找到正确的参数,我先输入
code_lowered( Theme, () )
Run Code Online (Sandbox Code Playgroud)
它给出了参数列表,然后
less( Gadfly.default_discrete_highlight_color )
Run Code Online (Sandbox Code Playgroud)
它显示了如何定义默认值.