我制作了这样的情节:
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"))))
如您所见,点周围的白色圆圈使得图中的高密度部分几乎为白色。
我想将点的外圆颜色更改为黑色(或蓝色),以更好地显示这些点确实存在。
从the Gadfly documentation开始,似乎highlight_color
的{{1}}参数可能会这样做,但它需要一个函数作为参数。
我不明白这是怎么回事。有什么想法吗?
答案 0 :(得分:7)
参数名称为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"))
)
)
要找到正确的参数,我先输入
code_lowered( Theme, () )
给出了参数列表, 然后
less( Gadfly.default_discrete_highlight_color )
显示如何定义默认值。
答案 1 :(得分:0)