You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While working on #1152, I noticed some troublesome behavior related to the usage of cycle for the color aesthetic. It occurs when the length of the color vector is > 1 and < n where n is the length of the other aesthetics.
length(color) == n
using RDatasets, Gadfly
data =dataset("datasets", "HairEyeColor")
plot(data, x=:Freq, color=:Sex, Geom.density)
This looks really weird. It turns out that what is happening is happening is that it assigns the first x value to blue, the next to orange, followed by blue, etc. I don't think there is any reason that the user would predict this behavior. Here's where it happens:
Other geometries (Geom.line, etc) prohibit the color vector from having a different dimension from the other aesthetics. I think this is a safer approach, even if it gets rid of the convenience situation of length(color) == 1. Our other option is enforce that length(color) == 1 or == n for all geometries. I think we should be consistent either way.
Also, it looks like several other geometries (notably Geom.histogram and Geom.boxplot) also make this same mistake
The text was updated successfully, but these errors were encountered:
While working on #1152, I noticed some troublesome behavior related to the usage of
cycle
for the color aesthetic. It occurs when the length of the color vector is > 1 and <n
wheren
is the length of the other aesthetics.length(color) == n
This is the correct behavior
length(color) == 1
Also correct behavior
1 < length(color) < n
This looks really weird. It turns out that what is happening is happening is that it assigns the first x value to blue, the next to orange, followed by blue, etc. I don't think there is any reason that the user would predict this behavior. Here's where it happens:
Gadfly.jl/src/statistics.jl
Lines 511 to 516 in f28c02c
Other geometries (
Geom.line
, etc) prohibit the color vector from having a different dimension from the other aesthetics. I think this is a safer approach, even if it gets rid of the convenience situation oflength(color) == 1
. Our other option is enforce thatlength(color) == 1 or == n
for all geometries. I think we should be consistent either way.Also, it looks like several other geometries (notably
Geom.histogram
andGeom.boxplot
) also make this same mistakeThe text was updated successfully, but these errors were encountered: