Guide.colorkey

Guide.colorkey

Guide.colorkey enables control of some fields of the auto-generated colorkey. Currently, you can change the colorkey title (for any plot), the item labels (for plots with a discrete color scale), and put the colorkey inside any plot. The fields can be named e.g. Guide.colorkey(title="Group", labels=["A","B"], pos=[0w,0h]), or given in order e.g. Guide.colorkey("Group", ["A","B"], [0w,0h]).

Arguments

Colorkey position

pos can be given in relative or absolute units (do using Compose before plotting):

Examples

Dsleep = dataset("ggplot2", "msleep")[[:Vore,:BrainWt,:BodyWt,:SleepTotal]]
completecases!(Dsleep)
Dsleep[:SleepTime] = Dsleep[:SleepTotal] .> 8
plot(Dsleep, x=:BodyWt, y=:BrainWt, Geom.point, color=:SleepTime,
    Guide.colorkey(title="Sleep \n(hours/day)\n ", labels=[">8","≤8"]),
    Scale.x_log10, Scale.y_log10 )
BodyWt 10-4 10-2 100 102 104 >8 ≤8 Sleep (hours/day) 10-4 10-3 10-2 10-1 100 101 BrainWt
iris = dataset("datasets","iris")
pa = plot(iris, x=:SepalLength, y=:PetalLength, color=:Species, Geom.point,
      Theme(key_position=:inside) )
pb = plot(iris, x=:SepalLength, y=:PetalLength, color=:Species, Geom.point,
      Guide.colorkey(title="Iris", pos=[0.05w,-0.28h]) )
hstack(pa, pb)
SepalLength 4 5 6 7 8 setosa versicolor virginica Iris 0 2 4 6 8 PetalLength SepalLength 4 5 6 7 8 setosa versicolor virginica Species 0 2 4 6 8 PetalLength