gadfly color group

This commit is contained in:
Thomas Breloff 2015-09-25 17:03:57 -04:00
parent 6f1ef82e89
commit 730d764c6e
3 changed files with 26 additions and 20 deletions

File diff suppressed because one or more lines are too long

View File

@ -231,6 +231,7 @@ end
# update the defaults globally # update the defaults globally
function plotDefault(k::Symbol) function plotDefault(k::Symbol)
k = get(_keyAliases, k, k)
if haskey(_seriesDefaults, k) if haskey(_seriesDefaults, k)
return _seriesDefaults[k] return _seriesDefaults[k]
elseif haskey(_plotDefaults, k) elseif haskey(_plotDefaults, k)
@ -241,6 +242,7 @@ function plotDefault(k::Symbol)
end end
function plotDefault!(k::Symbol, v) function plotDefault!(k::Symbol, v)
k = get(_keyAliases, k, k)
if haskey(_seriesDefaults, k) if haskey(_seriesDefaults, k)
_seriesDefaults[k] = v _seriesDefaults[k] = v
elseif haskey(_plotDefaults, k) elseif haskey(_plotDefaults, k)
@ -250,6 +252,12 @@ function plotDefault!(k::Symbol, v)
end end
end end
function plotDefault!(; kw...)
for (k,v) in kw
plotDefault!(k, v)
end
end
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------

View File

@ -171,8 +171,9 @@ function addGadflySeries!(gplt, d::Dict, initargs::Dict)
# then the vector passed to the "color" keyword should be a vector: [1,1,2,2,3,3,4,4, ..., i,i, ... , n,n] # then the vector passed to the "color" keyword should be a vector: [1,1,2,2,3,3,4,4, ..., i,i, ... , n,n]
csindices = Int[mod1(i,length(d[:color])) for i in 1:length(d[:y])] csindices = Int[mod1(i,length(d[:color])) for i in 1:length(d[:y])]
cs = collect(repmat(csindices', 2, 1))[1:end-1] cs = collect(repmat(csindices', 2, 1))[1:end-1]
grp = collect(repmat((1:length(d[:y]))', 2, 1))[1:end-1]
d[:x], d[:y] = map(createSegments, (d[:x], d[:y])) d[:x], d[:y] = map(createSegments, (d[:x], d[:y]))
colorgroup = [(:color, cs)] colorgroup = [(:color, cs), (:group, grp)]
else else
colorgroup = [] colorgroup = []
end end