-
Notifications
You must be signed in to change notification settings - Fork 98
Open
Description
Hi,
Sorry to ask as a new user. When I want to compare two columns with layers, I cannot encode color with two columns. Even if I add the encodeColor on the second layer, it doesn't behave as I expected.
Below is original code:
val data = Seq(
("te1", 300.0, 17.0),
("te2", 50.0, 19.0),
("te1", 40.2, 21.3),
("te2", 15.0, 21.5)
)
val df = spark.createDataFrame(data).toDF("col", "data1", "data2")
Vegas.layered("Plots two layers").
withDataFrame(df).
withLayers(
Layer().
mark(Bar).
encodeX("col", Ordinal, scale=Scale(bandSize=10)).
encodeY("data1", Quantitative).
encodeColor(field="data1", dataType=Quantitative),
Layer().
mark(Bar).
encodeX("col", Ordinal, scale=Scale(bandSize=10)).
encodeY("data2", Quantitative)
).
show
After I add the encodeColor on second layer, it behaves as below:
Vegas.layered("Plots two layers").
withDataFrame(df).
withLayers(
Layer().
mark(Bar).
encodeX("col", Ordinal, scale=Scale(bandSize=10)).
encodeY("data1", Quantitative).
encodeColor(field="data1", dataType=Quantitative),
Layer().
mark(Bar).
encodeX("col", Ordinal, scale=Scale(bandSize=10)).
encodeY("data2", Quantitative).
encodeColor(field="data2", dataType=Quantitative)
).
show
Metadata
Metadata
Assignees
Labels
No labels