Gadfly.with_theme(:dark)下如何将colorkey去掉

如题

using Gadfly, DataFrames

X = DataFrame(:x=>rand(4),:y=>rand(4),:z=>["1", "1", "2", "2"])

Gadfly.with_theme(:dark) do
    plot(X, x=:x, y=:y, color=:z)
end

绘图结果如上所示,如何将右边的z 1 2去掉(在:dark主题下)

也就是要去掉 Legend。

Gadfly.with_theme(Theme(Gadfly.dark_theme, key_position=:none)) do
    plot(X, x=:x, y=:y, color=:z)
end

image

这个包文档不多,我是在源码里搜出来的

2 个赞

我以plot( X, x=:x, y=:y, color=:z, Guide.colorkey(pos=[0,0]))这种方式实现的,因为文档里提到 ... pos overrides Theme(key_position=) and can be in either relative (e.g. [0.7w, 0.2h] is the lower right quadrant), absolute (e.g. [0mm, 0mm]), or plot scale (e.g. [0,0]) coordinates.,但是又觉得肯定不对 :joy:,非常感谢哈

备案号:京ICP备17009874号-2